PNG or JPG to ICO, not squared.
PNG or JPG to ICO, not squared.
Hello everybody.
I have a little problem, and i'm pretty sure there's a solution.
I'm trying to convert a lot of movie covers to ICO format. The command i use is:
convert -resize 256x256 movie.jpg movie.ico
It converts fine, but the resulting icon is squared and not rectangular like a dvd cover. Is there an option that i need to add?
The result i'm looking for is the same result this site gives: http://converticon.com/
But i need to be able to do this from the command line because i need it for a script i'm writing.
Thank you .
I have a little problem, and i'm pretty sure there's a solution.
I'm trying to convert a lot of movie covers to ICO format. The command i use is:
convert -resize 256x256 movie.jpg movie.ico
It converts fine, but the resulting icon is squared and not rectangular like a dvd cover. Is there an option that i need to add?
The result i'm looking for is the same result this site gives: http://converticon.com/
But i need to be able to do this from the command line because i need it for a script i'm writing.
Thank you .
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: PNG or JPG to ICO, not squared.
Post a link to one of your images that needs converting to non-square format.
Re: PNG or JPG to ICO, not squared.
I thought ico files were always square; it may be something built into the format?
If so try padding the image to make it square before resizing it.
If so try padding the image to make it square before resizing it.
Re: PNG or JPG to ICO, not squared.
My mistake - just tried it and works OK on a rectangular file.
Your command is slightly wrong and should be:
Looking at the thumbnail in windows it looks square but when you click on it to open it is rectangular - strange.
Your command is slightly wrong and should be:
Code: Select all
convert movie.jpg -resize 256x256 movie.ico
Re: PNG or JPG to ICO, not squared.
That's exactly my problem. When you set that icon as a folder icon it looks squared, while using an icon created with the site in the first post it looks fine. I need it rectangular for setting the icon in every folders in my movie's directory, and there are quite a few .Bonzo wrote:My mistake - just tried it and works OK on a rectangular file.
Your command is slightly wrong and should be:Looking at the thumbnail in windows it looks square but when you click on it to open it is rectangular - strange.Code: Select all
convert movie.jpg -resize 256x256 movie.ico
Re: PNG or JPG to ICO, not squared.
I would say you need to add extent to pad the image square with either a transparent or white background and then resize it.
Re: PNG or JPG to ICO, not squared.
I tried adding a transparent padding with photoshop and it worked, have you any ideas on how to do this in imagemagick? Great tip by the way, at least now i have something to try .Bonzo wrote:I would say you need to add extent to pad the image square with either a transparent or white background and then resize it.
Re: PNG or JPG to ICO, not squared.
If all you images are the same size it is easier but can be calculated with the fx command. How are you running the command windows command, batch, linux, shell etc?
Try this the dimensions of extent need to be correct for the original image ( in this case the original image would be 500px high ):
Try this the dimensions of extent need to be correct for the original image ( in this case the original image would be 500px high ):
Code: Select all
convert input.jpg -background transparent -gravity center -extent 500x500 -resize 256x256 movie.ico
Re: PNG or JPG to ICO, not squared.
Thank you very much! It works wonder .Bonzo wrote:If all you images are the same size it is easier but can be calculated with the fx command. How are you running the command windows command, batch, linux, shell etc?
Try this the dimensions of extent need to be correct for the original image ( in this case the original image would be 500px high ):Code: Select all
convert input.jpg -background transparent -gravity center -extent 500x500 -resize 256x256 movie.ico
It will be launched by a script in powershell, a pretty easy one. Resizing an image before running this command is no problem. It will be something like this:
Code: Select all
foreach (element in ls) {
convert .\element\movie.png -resize x500 .\element\movie.png
convert .\element\movie.png -background transparent -gravity center -extent 500x500 -resize 256x256 .\element\movie.ico
rm movie.png
cp C:\Desktop.ini .\element
}
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: PNG or JPG to ICO, not squared.
Seems to me, to be more efficient, that you want to resize then pad, if you want it to be square.convert input.jpg -background transparent -gravity center -extent 500x500 -resize 256x256 movie.ico
convert input.jpg -resize 256x256 -background transparent -gravity center -extent 256x256 movie.ico
but then I don't know much about ico files.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: PNG or JPG to ICO, not squared.
For methods of padding images and thumbnails see IM examples, Thumbnailling
http://www.imagemagick.org/Usage/thumbnails/#pad
http://www.imagemagick.org/Usage/thumbnails/#pad
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/