Page 1 of 1

Cropping .mpc file using Filename Percent Escape

Posted: 2010-05-28T13:17:02-07:00
by snake211
Hi gurus,

I am cropping an image which is stored as .mpc format. Cropping it without x-, y- offsets creates tiles with auto-generated output filenames. To control the output filenames, I want to use the "Filename Percent Escape". I am using shell script and below is the code:

---------------------
$mpc_tmp="./tmp_$$.mpc"
$cache_tmp="./tmp_$$.cache"

convert "xxx.jpg" $mpc_tmp
# [above] storing xxx.jpg into a variable is inevitable because of other processes which are omitted here.
...
convert $mpc_tmp -crop 256x256 -set filename:tile "%[fx:page.x/256+1]_%[fx:page.y/256+1]" +repage +adjoin "tile_%[filename:tile].jpg"
---------------------

This does not work. It only generates the .jpg tiles with tiny sizes (about 300bytes). Also, this generates .cache files with the same names (tile_*_*.cache) as the .jpg files. These .cache files are huge (about 500 mbytes).

If I save $mpc_tmp into a dummy .jpg file, and then crop, it works:
---------------------
convert $mpc_tmp "tmp.jpg"
convert "tmp.jpg" -crop 256x256 -set filename:tile "%[fx:page.x/256+1]_%[fx:page.y/256+1]" +repage +adjoin "tile_%[filename:tile].jpg"
---------------------

Does anyone know why this is happening? I know that cropping without using the "Filename Percent Escape" works just fine on the .mpc files.

Thanks in advance.

J.R.

Re: Cropping .mpc file using Filename Percent Escape

Posted: 2010-05-29T07:42:12-07:00
by magick
We can reproduce the problem you posted and have a patch in ImageMagick 6.6.2-1 Beta. Thanks.