Crop HD Frames in Half

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
User avatar
bydersjoint
Posts: 6
Joined: 2010-11-16T23:27:28-07:00
Authentication code: 8675308

Crop HD Frames in Half

Post by bydersjoint »

Hi All,
This is a really weird thing I am getting.

I have an HD frame of 1920x1080 and want to process it twice... once giving me the top 540pixels and the command '-crop 1920x540+0+0' works perfectly for this, but the minute I try to crop the top half out leaving me with the lower portion of the image using '-crop 1920x540+0+540' I simply get black frames returned.

My process doesn't end there though, I perform a -resize and then another -crop after the initial crop (above) and then place the result in the center of a larger frame using '-background black -gravity Center -extent 2048x1080'

Could the '-gravity Center' that comes 4 commands after the 540pixel crop be affecting its usage?!

Thanks,
Chris
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: Crop HD Frames in Half

Post by GreenKoopa »

I don't immediately see anything helpful. No, a setting after should not affect a command from before. Settings before, even ones intended for another operation (even when in parentheses) will. Is the black frame the correct size? It would be helpful if you could provide the shortest example that has the unexpected behavior.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Crop HD Frames in Half

Post by Bonzo »

My process doesn't end there though, I perform a -resize and then another -crop after the initial crop (above) and then place the result in the center of a larger frame using '-background black -gravity Center -extent 2048x1080'
Why not check the resulting images after each process to find where the problem occures ?

Your full code would be useful to see.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Crop HD Frames in Half

Post by fmw42 »

your input image may already have a virtual canvas with an offset.

try

convert image +repage -crop ... +repage result

see http://www.imagemagick.org/Usage/crop/#crop_repage
Post Reply