Page 1 of 1
Don't know how to fill background of image
Posted: 2011-10-23T05:02:03-07:00
by monkey
Hello people!
First of all I'm new here, I'm also new to ubuntu commands and creating .sh scripts. I'm using a script made by a user that allows you to create thumbnails from a video, here's the code:
http://cli-apps.org/CONTENT/content-files/74676-shot.
I've searched high and low and I found a couple of topics about the bg color but I don't know where to put the convert line.
I've used:
convert source -background "#ddddff" target
right before this line: convert "$file_name".jpg -quality $quality -splice 0x80 -draw 'image over 5,5 0,0 text.jpg' "$path/$file_name".jpg (it's located almost at the bottom of the page) and it filled only the top of the picture, leaving the text background and the space between stills white.
Like I said, I'm new to this kind of stuff and I would really appreciate a little help from you guys.
Thank you.
Re: Don't know how to fill background of image
Posted: 2011-10-23T10:51:20-07:00
by fmw42
can you explain functionally what you want to do? can you provide a link to an image and tell us what you want to change in it?
-background some color
is just a setting for other operators. If you want to change the background color of some image, you probably need to floodfill it from the outside with some fuzz value to allow it to change the color if it is not a solid color but has some variation.
But it is hard to tell you what to do without really understanding your problem from a simple point of view of processing one image. Your script is rather complex and no one probably wants to figure out what it is doing.
see
http://www.imagemagick.org/Usage/draw/#color
http://www.imagemagick.org/script/comma ... s.php#fuzz
Re: Don't know how to fill background of image
Posted: 2011-10-23T12:23:10-07:00
by monkey
I'm sorry about that, forgot to say the script creates thumbnails of a video file and it depends on mplayer and imagemagick.
Here's what the picture looks like with default background color (the script is unchanged):
http://imageshack.us/f/804/59046114.jpg/
And this is what I get if I add convert source -background color target:
http://imageshack.us/f/835/ushercaughtuphq.jpg/
There's the problem, it doesn't fill the whole background. Default color remains behind video info text and between thumbnails.
Re: Don't know how to fill background of image
Posted: 2011-10-23T12:41:56-07:00
by Bonzo
I would guess you need to change the background colour in two other locations as well.
This line creats the text image and I would try adding a background colour:
Code: Select all
echo -e "File name: $file_name_ext\nSize: $size Mb\nResolution: $format\nDuration: $length min." | convert -background red -pointsize 16 -trim +repage text:- text.jpg
I think this line creates the screen shots so try adding a background there as well:
Code: Select all
montage -background red -geometry +2+2 `ls *.png | sort -n` "$file_name".jpg
Re: Don't know how to fill background of image
Posted: 2011-10-23T14:23:20-07:00
by monkey
Bonzo, a heart full of thanks for your help. Those were exactly the two things I was missing.
As you said, the first one is for the text background, the second one is for the space between the shots and the last one is for the remaining space.
It creates separate layers (text, thumbnails, etc) and then merges them.
Thanks again for your help.
Re: Don't know how to fill background of image
Posted: 2011-10-24T02:37:45-07:00
by Bonzo
Its good you are sorted - on another subject the tempory images are saved as jpg; saving them as png or miff should improve your final image quality. Worth a test ?
Re: Don't know how to fill background of image
Posted: 2011-10-25T10:05:55-07:00
by monkey
The conversion from png to jpg is a good thing (in my case) because I want my images to be compressed, the less file size the better.
Re: Don't know how to fill background of image
Posted: 2011-10-25T22:27:59-07:00
by anthony
Fir the final image yes. But intermediate temporary images, using a Lossy Compression File format is NOT a good idea.
The more time you save to JPEG the more data lost you will get.
It is only temporary any way, and such data is typically saved for just for a few seconds on a separate 'work in progress' area (usually "/tmp").
What ever you do do, preserve the original and always work from the original is possible.