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?".
Now I'm looking to so something similar, but horizontally instead.
I don't want to center the cropped images horizontally, because all the pages are different lengths
So I want to add a 28px border to the top instead
Then I want to pad the remainder of the image at the bottom to make it 1024px high.
I've managed to create the following code so far to crop the top and the bottom of the image...
... -background white -gravity north -splice 0x28 -extent x1024 ...
That sets the background color to white, sets the gravity to north, splices 28 pixels of the background color onto the top, then keeps all that to the north while making the output a total of 1024 pixels high. For the "-extent" operation you can use that "%[dimensions]" variable you set instead of "x1024" to make the output match the original dimensions.
If you want to trim the image, then pad 28 at the top and make the result 1024 tall with the trimmed image in the middle horizontally of your original width, then you can do
Try this. It stores the original image width. Then it does a trim only at the top, by padding the bottom with one row of black. Then I chop off the bottom black row. Then I extend the image so that it is centered horizontally but shifted down 28 pixels and filled with white to 1024 height.