Crop and extend - page offsets are too high - incorrect names of tiles
Posted: 2019-09-01T08:16:28-07:00
I have this command:
And I want to create 4 same-sized tiles of size 170x180. Only one tile will be fully filled, others use extent and area will be filled blue.
So far so good, tiles of same sizes are created.
However, problem is with page.x and page.y because I cannot create correct naming. What I got from verbose is this:
It should create tiles with names 0_0, 0_1, 1_0 and 1_1. Even if I use ceil or floor for page.x and page.y, it wont be correct (eg. 2.36667 is not 1). What is wrong? What is the reason for dimensions 506 and 606?
Code: Select all
convert "lenna256x256.png" -verbose -crop "170x180" \
-background blue \
-extent "170x180" \
-format "jpg" -quality 60 \
-set filename:f "./temp_dir/rgba|%[fx:w]x%[fx:h]|%[fx:page.width]x%[fx:page.height]|%[fx:page.x/170]_%[fx:page.y/180]" \
"%[filename:f].jpg"
So far so good, tiles of same sizes are created.
However, problem is with page.x and page.y because I cannot create correct naming. What I got from verbose is this:
Code: Select all
lenna256x256.png=>./temp_dir/rgba|170x180|256x256|0_0.jpg[0] PNG 256x256=>170x180 256x256+0+0 8-bit Grayscale Gray 4039B 0.063u 0:00.062
lenna256x256.png=>./temp_dir/rgba|170x180|506x256|1.97647_0.jpg[1] PNG 256x256=>170x180 506x256+336+0 8-bit sRGB 2516B 0.047u 0:00.042
lenna256x256.png=>./temp_dir/rgba|170x180|256x606|0_2.36667.jpg[2] PNG 256x256=>170x180 256x606+0+426 8-bit sRGB 2614B 0.031u 0:00.031
lenna256x256.png=>./temp_dir/rgba|170x180|506x606|1.97647_2.36667.jpg[3] PNG 256x256=>170x180 506x606+336+426 8-bit sRGB 1614B 0.015u 0:00.019