covert command bug

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
swingcoder
Posts: 3
Joined: 2020-01-12T05:22:52-07:00
Authentication code: 1152

covert command bug

Post by swingcoder »

the fx expression page.y has a bug.
I have a image dimension 27017x1080, with the following cmd

convert /Volumes/disk2/tmp/qqfiles/long-pic.jpg -gravity NorthWest -crop 512x512 -resize 512x512 -background "#333333" -extent 512x512 -set filename:tile "%[fx:ceil(page.y/512)]_%[fx:ceil(page.x/512)]" +repage +adjoin /Volumes/disk2/tmp/qqfiles/tiles/tile_%[filename:tile].jpg

the generated filename has error like tile_19_0.jpg,tile_19_1.jpg... but, it should be tile_2_0.jpg,tile_2_1.jpg, i have checked the page.y orignal value is tile_9362_0.jpg and tile_9362_512.jpg

page.x is fine.

so, how can i deal with it?

thanks!

snibgo
Posts: 12556
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: covert command bug

Post by snibgo »

The bug is in your command. Move "-extent" to after "+repage".
snibgo's IM pages: im.snibgo.com

swingcoder
Posts: 3
Joined: 2020-01-12T05:22:52-07:00
Authentication code: 1152

Re: covert command bug

Post by swingcoder »

snibgo wrote:
2020-01-12T09:37:47-07:00
The bug is in your command. Move "-extent" to after "+repage".
convert /Volumes/disk2/tmp/qqfiles/long-pic.jpg -gravity NorthWest -crop 512x512 -resize 512x512 -background "#333333" -set filename:tile "%[fx:ceil(page.y/512)+1]_%[fx:ceil(page.x/512)+1]" +repage -extent 512x512 +adjoin /Volumes/disk2/tmp/qqfiles/tiles/tile_%[filename:tile].jpg

the last piece got name: tile_4_69.jpg not tile_3_53.jpg, any suggestions? thanks!

snibgo
Posts: 12556
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: covert command bug

Post by snibgo »

The problem is "-resize". This can change only the crop at bottom-right, because all the other crops have one or both dimensions 512. Do you really want to resize that crop? Why?

If you don't want to resize it, then remove the "-resize".

If you do need it, move "-set filename" to before the "-resize".
snibgo's IM pages: im.snibgo.com

swingcoder
Posts: 3
Joined: 2020-01-12T05:22:52-07:00
Authentication code: 1152

Re: covert command bug

Post by swingcoder »

snibgo wrote:
2020-01-12T19:01:23-07:00
The problem is "-resize". This can change only the crop at bottom-right, because all the other crops have one or both dimensions 512. Do you really want to resize that crop? Why?

If you don't want to resize it, then remove the "-resize".

If you do need it, move "-set filename" to before the "-resize".
-resize is optional, after remove it works fine now, thanks for you help!

Post Reply