-crop (Border-Tiles, which are not smaller)

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
forumim

-crop (Border-Tiles, which are not smaller)

Post by forumim »

Hy

I tile a image:
convert -crop 100x100 -fill blue -quality 30 image.jpg test%02d.jpg

Unfotunately, the rightmost tiles and the bottom tiles are smaller
if the specified geometry extends beyond the dimensions of the input image.

I need the rightmost tiles and the bottom tiles in the same size. (100x100)
The area beyond the dimensions of the input image I would like to fill
with the color blue.

How is it possible?
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: -crop (Border-Tiles, which are not smaller)

Post by Bonzo »

What about compositing your image onto a blue image of the correct size first and then doing your crop ?
So if your image is 980 x 860 make a blue image 1000 x 900 composite your image onto it and then run your crop on the new image.

Untested but something like:

Code: Select all

convert 1000x900 xc:blue image.jpg -gravity northwest -composite temp.png
convert temp.png -crop 100x100 -quality 30 test%02d.jpg
forumim

Re: -crop (Border-Tiles, which are not smaller)

Post by forumim »

A great simple idea! Thanks!

Code: Select all

convert -size 1000x900 xc:blue image.jpg -gravity northwest -composite temp.png
I added -size, it works fine!
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: -crop (Border-Tiles, which are not smaller)

Post by anthony »

The faster way is to get IM to just add the pixels using -background blue -extent 1000x900

See IM examples, Cutting and Bordering for all the details of this type of thing. Also see thumbnails, Padding Images, for other mtheods for 'centered' padding.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply