Page 1 of 1

Problem with -splice

Posted: 2008-01-01T11:43:43-07:00
by fbingha
Using 6.3.6 on Windows.

Source image is 933x73 JPEG

Command is:

Code: Select all

convert.exe -size 150x150 file.jpg -thumbnail "150x150>" -sharpen 0x1 -gravity South -background "#000000" -splice 0x15 -fill white -pointsize 11 -draw "text 0,0 '933x73 20kb JPEG'" -bordercolor "#000000" -compose Copy -border 1 -quality 75
Expected output is a thumbnail with a black border underneath with the original image dimensions. In reality the spliced section is not added to the image resulting in the text being applied over the image.

If you execute this with a 933x95 image then it works as expected with a black section at the bottom with the image dimensions. This bug has something to do with images that are very wide in comparison to their height as the above code has been used millions of times over the years to generate thumbnails without problems.

Re: Problem with -splice

Posted: 2008-01-03T19:39:29-07:00
by anthony
The latest IM produces the correct output AFTER I added a output filename on the end of the command.

trying a 933x95 image --- good
trying 933x73 still good.
trying a very thin (height wise image -- bad...

definite bug happens when the height of the splice is larger than the height of the image having the splice added. the splice operation is in that instance no-op'd

here is a simplified example of the bug...

For example this works...

Code: Select all

convert -size 100x15 xc:red -gravity South -background "#000000" -splice 0x15  x:
this fails

Code: Select all

convert -size 100x15 xc:red -gravity South -background "#000000" -splice 0x16  x:
Removing -gravity South will make the splice work again, so it is probably a gravity calculation failure.
DEFINITE BUG

Re: Problem with -splice

Posted: 2008-01-03T20:09:24-07:00
by fbingha
Glad that you are able to reproduce it. Definitely happens for me with the 933x73 image that was submitted to me with the bug from a customer. Do you know of any way to workaround this bug, still achieve -gravity south?

Re: Problem with -splice

Posted: 2008-01-03T22:22:54-07:00
by anthony
replace -gravity South -splice 0x15
with -flip -splice 0x15 -flip
OR use -border 0x15 -chop 0x15
with border color instead of background color
For more info see IM Examples, Cutting and Bordering

Note you will need to set -gravity South after the above but before -draw or better still -annotate the text