I am using ImageMagick commands as part of a Java application I am developing.
I want to do the following:
Inputs:
1. A JPEG file, of arbitrary length/width (But not smaller than, say, 500 x 500 pixels)
2. A text string, of an arbitrary length (but not super long. Maybe a paragraph at most.)
Outputs:
1. The JPEG file, which has a white 'band' appended to the bottom containing the text.
The original image's dimensions will definitely increase due to the added label.
2. The same JPEG file, which has the text displayed with a semi-transparent background
directly on top of the image, along the bottom side. The original image's dimensions will not change because
the text will simply be overlayed on it.
Now, I tried this using some FAQ I found online but the text always seems to overflow
from the image (and as a result I can only read part of it.)
Is there a way to get ImageMagick to figure out the right fontsize given an image width,
create the 'band' (label) separately with that fontsize and width, and append it to the original
image? I do understand that if we have a large space and short text, the text may become
huge and that's alright for now.
Thanks!
Best command to create a label below an image?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Best command to create a label below an image?
see label: it will fill the text to the image size and pick the best pointsize if you don't specify the pointsize
http://www.imagemagick.org/Usage/text/#label
then you can append it below the other image using -append
http://www.imagemagick.org/script/comma ... php#append
http://www.imagemagick.org/Usage/layers/#append
You can also do the labeling below an image using montage
http://www.imagemagick.org/Usage/montage/#label
http://www.imagemagick.org/Usage/text/#label
then you can append it below the other image using -append
http://www.imagemagick.org/script/comma ... php#append
http://www.imagemagick.org/Usage/layers/#append
You can also do the labeling below an image using montage
http://www.imagemagick.org/Usage/montage/#label
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Best command to create a label below an image?
A large number of methods of annotating (labeling) images in various ways are listed in IM Examples, Annotating Images.
http://www.imagemagick.org/Usage/annotating/
WARNING: reading JPEG and then saving back to JPEG will degrade the image.
This is because JPEG is a lossy format. Best idea is to start with the original image and only save the final image to JPEG. do not use JPEg for intermediate image processing!
See JPEG Format
http://www.imagemagick.org/Usage/formats/#jpg
http://www.imagemagick.org/Usage/annotating/
WARNING: reading JPEG and then saving back to JPEG will degrade the image.
This is because JPEG is a lossy format. Best idea is to start with the original image and only save the final image to JPEG. do not use JPEg for intermediate image processing!
See JPEG Format
http://www.imagemagick.org/Usage/formats/#jpg
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/