Results 1 to 9 of 9
hi I have to put a text on a picture, count the pixels of the text and then place another text next to the first one. My question is how ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 02-24-2006 #1Just Joined!
- Join Date
- Feb 2006
- Posts
- 51
Reading the number of pixels in a text string with Shell script
hi I have to put a text on a picture, count the pixels of the text and then place another text next to the first one. My question is how to count the pixels using only Bash Shell script. thanks
- 02-24-2006 #2
I'm guessing you're asking for a command line app that alters images - there's not a lot of non-GUI apps that let you do that, but almost certainly ImageMagick is the most full-featured. There's capabilities in those utilities that let you generate text, etc. Should be possible.
DT
- 02-24-2006 #3Linux Enthusiast
- Join Date
- Jun 2005
- Posts
- 668
Agreed, I was just going to mention imagemagick
I use it for batch resizing / conversion of images, its awesome. and can do what you've stated pretty easily I expect.
for example, to change an images sizeCode:convert cat-large.jpg -resize 640x480 cat-small.jpg
- 02-24-2006 #4Just Joined!
- Join Date
- Feb 2006
- Posts
- 51
thanks but I have already tried with imagemagic. I agree it is fun but my question is about reading the number of pixels in a string. All the tools in image magic want to tell them the size of the picture BEFORE overlapping. so I need to know the pixels first and I intend to let image magic do the rest
. but thanks anyway
- 02-24-2006 #5
maybe SDL_image is also an option?
I'm not really sure if that works for what you want to do but i think so ....
- 02-24-2006 #6
I'm not getting it. Seems like all you're asking for is to query pixel width - it's easy with "identify" from Imagemagick. If your problem is that you need to do this to a "virtual" image(your super), then pregenerate it, put it somewhere temp, do your calc, generate the next, etc.
DT
- 02-24-2006 #7Just Joined!
- Join Date
- Feb 2006
- Posts
- 51
hey thanks DThor
now I know what to do. you really helped me , thanks.
- 02-26-2006 #8Just Joined!
- Join Date
- Feb 2006
- Posts
- 51
Hi again, I learned how to read image info with ImageMagick but I could not understand how to pregenerate an image? all the tools in ImageMagick want me to specify size atribute before they can draw the image. So I will very much appreciate a little more help with this.
- 02-26-2006 #9
Maybe someone that actually uses these utils will jump in, all I really meant was if for some reason you need to know the pixel width of something you haven't got yet, then make it first, stuffing it in /tmp, call it something specific, then check it's width, do whatever you want to do with it then delete it when finished. It was more a workflow suggestion rather than specifically what to do. I suspect you don't really know all the capabilities of ImageMagick(given a quick google told me about the "identify" param), so whenever I'm in that situation, I start reading some docs. It may well be that what you need to do is trivial and you don't really need to approach it this way at all. I'm not entirely clear on what you want to do, though.

DT


Reply With Quote
