Page 1 of 1

Coordinate not correct when using crop and extent together

Posted: 2015-11-16T18:32:03-07:00
by sangdaono
Here the command i used to splice an image into multiple:

Code: Select all

convert "input.jpg" -resize 1135x -crop 256x256 -background transparent -extent 256x256 -set filename:tile "%[fx:page.x/256]_%[fx:page.y/256]" +repage +adjoin "output\%[filename:tile].png"
Here the result:
Image
The last piece of the column was wrong y coordinate. it's return 9.25391 instead of 3. It should be 0_3.png. If i remove "extent 256x256", it's return correctly but some image not fit with size 256x256. I need all image have to be 256x256, if it not, extend the image and add transparent background it as the command above.
Thanks!

Re: Coordinate not correct when using crop and extent together

Posted: 2015-11-16T19:41:29-07:00
by fmw42
Try putting the -set filename... before the -extent:

Code: Select all

convert "input.jpg" -resize 1135x -crop 256x256 -set filename:tile "%[fx:page.x/256]_%[fx:page.y/256]" -background transparent -extent 256x256 +repage +adjoin "output%[filename:tile].png"
This seems to work fine for me on IM 6.9.2.6 Q16 Mac OSX. Note on Unix it works better without the \ before %.

Please always provide your IM version and platform.

Re: Coordinate not correct when using crop and extent together

Posted: 2015-11-16T20:57:21-07:00
by sangdaono
Thank you so much. It's worked like charm!
I'm using IM 6.9.2-1 Q16 Win64