Can't create .ico files
Can't create .ico files
Hi I'm try to make .ico files out of jpg if possible.
I've looked around at several examples and can't seem to get something that will make a successful
.ico file that will work as a favicon in Internet explorer.
My current attempt is
/usr/bin/convert -crop 16x16+0+0 /media/usbdisk1/development/foliopic-site/richard/images/sites/1/favicons/normal/1280749655.jpg -transparent white -background white -flatten -resize 16x16 ico:/media/usbdisk1/development/foliopic-site/richard/images/sites/1/favicons/icons/1280749655.ico
But that doesn't seem to work.
I'm on IM 6.2.8
Version: ImageMagick 6.2.8 04/17/08 Q16 file:/usr/share/ImageMagick-6.2.8/doc/index.html
Copyright: Copyright (C) 1999-2006 ImageMagick Studio LLC
and I don't think there is a yum update to the next version yet.
Any help would be great.
Even if it's a GD or another program I've tried to get one called png2ico to work and that doesn't seem to do anything.
Any help would be great.
Thanks
Regards
Richard
I've looked around at several examples and can't seem to get something that will make a successful
.ico file that will work as a favicon in Internet explorer.
My current attempt is
/usr/bin/convert -crop 16x16+0+0 /media/usbdisk1/development/foliopic-site/richard/images/sites/1/favicons/normal/1280749655.jpg -transparent white -background white -flatten -resize 16x16 ico:/media/usbdisk1/development/foliopic-site/richard/images/sites/1/favicons/icons/1280749655.ico
But that doesn't seem to work.
I'm on IM 6.2.8
Version: ImageMagick 6.2.8 04/17/08 Q16 file:/usr/share/ImageMagick-6.2.8/doc/index.html
Copyright: Copyright (C) 1999-2006 ImageMagick Studio LLC
and I don't think there is a yum update to the next version yet.
Any help would be great.
Even if it's a GD or another program I've tried to get one called png2ico to work and that doesn't seem to do anything.
Any help would be great.
Thanks
Regards
Richard
Re: Can't create .ico files
When you're saying "doesn't seem to work" - what was the error?
You could try your commandlines first with e.g. .PNG instead of .ICO as output. If you're satisfied with the result, then switch to .ICO. Theoretically, it should work then.
A few potential problems:
Your ImageMagick version is very old.
And your commandline looks.. odd. You should still get an output from it, but I'm not sure if it's the intended output..?
Does a simple command like "convert input.jpg -resize 16x16 -transparent white output.ico" work for you?
You could try your commandlines first with e.g. .PNG instead of .ICO as output. If you're satisfied with the result, then switch to .ICO. Theoretically, it should work then.
A few potential problems:
Your ImageMagick version is very old.
And your commandline looks.. odd. You should still get an output from it, but I'm not sure if it's the intended output..?
Does a simple command like "convert input.jpg -resize 16x16 -transparent white output.ico" work for you?
Re: Can't create .ico files
Thanks for getting back to me,
I'm trying a few things out and will try the .png and then straight to .ico and see if that can help.
Currently I'm trying a gd script that seems to do a similar thing using imagepng function.
Fingers crossed.
Can't believe that it's this difficult!
I'll let you know how I get on.
Richard
I'm trying a few things out and will try the .png and then straight to .ico and see if that can help.
Currently I'm trying a gd script that seems to do a similar thing using imagepng function.
Fingers crossed.
Can't believe that it's this difficult!
I'll let you know how I get on.
Richard
Re: Can't create .ico files
Ok, it seems that the ImageMagik doesn't want to work,
Having said that if I take all the options out it gets really pixelly and generally naf.
The gd way seems to make an icon that at least I can view in Microsoft picture editor and in IE if I go straight to it but not in Adobe Photoshop - no biggee but neither in the favicon position.
Here is the gd code we are using
$im = imagecreatefromjpeg(FAVICONDIR.'normal/'.$filename);
list($width, $height) = getimagesize(FAVICONDIR.'normal/'.$filename); // get the width and height of the jpg
$image_p = imagecreatetruecolor("16", "16"); // create a 16x16 canvas to play with
imagecopyresampled($image_p, $im, 0, 0, 0, 0, "16", "16", $width, $height); // resize jpg to 16x16
$num = rand (1,99999); // generate a random number between 1 and 99999
imagepng($image_p,FAVICONDIR.'icons/'.$ico_filename); // make a .png file (icon file) from our data
imagedestroy ($im); // close gd library
any more ideas?
Thanks for you time
Richard
Having said that if I take all the options out it gets really pixelly and generally naf.
The gd way seems to make an icon that at least I can view in Microsoft picture editor and in IE if I go straight to it but not in Adobe Photoshop - no biggee but neither in the favicon position.
Here is the gd code we are using
$im = imagecreatefromjpeg(FAVICONDIR.'normal/'.$filename);
list($width, $height) = getimagesize(FAVICONDIR.'normal/'.$filename); // get the width and height of the jpg
$image_p = imagecreatetruecolor("16", "16"); // create a 16x16 canvas to play with
imagecopyresampled($image_p, $im, 0, 0, 0, 0, "16", "16", $width, $height); // resize jpg to 16x16
$num = rand (1,99999); // generate a random number between 1 and 99999
imagepng($image_p,FAVICONDIR.'icons/'.$ico_filename); // make a .png file (icon file) from our data
imagedestroy ($im); // close gd library
any more ideas?
Thanks for you time
Richard
Re: Can't create .ico files
No just tried some php /htaccess trickery with redirecting favicon.ico to a php file with the icon in it.
No dice.
Any ideas at all.
Thanks
Richard
No dice.
Any ideas at all.
Thanks
Richard
Re: Can't create .ico files
You should tell what exactly is the problem with the output from ImageMagick.
So, does ImageMagick create no .ICO at all? Or does it look weird? Or does the ICO itself look ok, but it isn't working as favicon? Perhaps it's not compatible enough or perhaps the place where you store the file is wrong. How should we know?
So, does ImageMagick create no .ICO at all? Or does it look weird? Or does the ICO itself look ok, but it isn't working as favicon? Perhaps it's not compatible enough or perhaps the place where you store the file is wrong. How should we know?
Re: Can't create .ico files
You need to read in your image before you work on it, try:
Why are you resizing to 16x16 when you have already cropped to 16x16 ? Strange it will not work without a resize.
Code: Select all
exec("convert /media/usbdisk1/development/foliopic-site/richard/images/sites/1/favicons/normal/1280749655.jpg -crop 16x16+0+0 -transparent white -flatten -resize 16x16 ico:/media/usbdisk1/development/foliopic-site/richard/images/sites/1/favicons/icons/1280749655.ico ");
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Can't create .ico files
don't know if this will help but try adding +repage after the crop
why are you using -transparent white and then flattening (which normally gets rid of the transparency as the default -bacground is white). Do you mean -background white -flatten? The whole command seems useless as you get the same as if you did not add -transparent white -flatten.
Try
convert image -gravity <whatever> -crop 16x16+0+0 +repage resultimage.ico
or if the image is large and you need to resize to about 16x16 (considering that it might not be square), then
convert image -resize "16x16^" -gravity center -crop 16x16+0+0 +repage resultimage.ico
why are you using -transparent white and then flattening (which normally gets rid of the transparency as the default -bacground is white). Do you mean -background white -flatten? The whole command seems useless as you get the same as if you did not add -transparent white -flatten.
Try
convert image -gravity <whatever> -crop 16x16+0+0 +repage resultimage.ico
or if the image is large and you need to resize to about 16x16 (considering that it might not be square), then
convert image -resize "16x16^" -gravity center -crop 16x16+0+0 +repage resultimage.ico
Re: Can't create .ico files
That would have been my suggestion, too - but as he's still on IM v6.2.8, "16x16^" probably won't work.fmw42 wrote:convert image -resize "16x16^" -gravity center -crop 16x16+0+0 +repage resultimage.ico
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Can't create .ico files
Drarakel wrote:That would have been my suggestion, too - but as he's still on IM v6.2.8, "16x16^" probably won't work.fmw42 wrote:convert image -resize "16x16^" -gravity center -crop 16x16+0+0 +repage resultimage.ico
Sorry I missed that. Yes, the ^ symbol to use the smaller dimension was added much later than IM 6.2.8.
Then I guess the best would be
convert image -resize 16x16 -gravity center -background white -extent 16x16 resultimage.ico
Which actually may be better as it shows the full image and nothing is cropped out.
This will make the largest side 16 and then extend the image with white to fill to 16x16 (or use whatever color or "none" for transparent if desired and allowed in ico files)
P.S. -extent was added in IM 6.2.4, but its use with -gravity was added at 6.3.2. So my command above may ignore the -gravity center and put the image in the upper left corner and the padding to the right/bottom.
Re: Can't create .ico files
Right this is the deal really I'm just trying to make a .ico file 16x16 I already have a jpg 16x16 so I would assume that I wouldn't need all the -resize -gravity center -background white -extent 16x16 options but even if I do I do get a .ico file but its really pixelly and just looks wrongDrarakel wrote:You should tell what exactly is the problem with the output from ImageMagick.
So, does ImageMagick create no .ICO at all? Or does it look weird? Or does the ICO itself look ok, but it isn't working as favicon? Perhaps it's not compatible enough or perhaps the place where you store the file is wrong. How should we know?
Here is a screen shot
http://www.flickr.com/photos/42114285@N05/4855924147/
I can make .png and .jpg that work in firefox but they don't work in ie and if I try and make a .ico file then no dice.
I've heard some talk that .ico and just png or bmp files but with a .ico ending but I've not had any result experimenting with that.
Thanks for all your help.
Regards
Richard
Re: Can't create .ico files
Uh.. Can you post a link to your input and output files?
(But even then, I'm not sure if someone can help. You're using an IM version that almost no one uses anymore.
)
(But even then, I'm not sure if someone can help. You're using an IM version that almost no one uses anymore.

Re: Can't create .ico files
The input files are the little ones at the bottom. The output is those pixelly ones just about it. With like almost corrupt white streaks.
Is there a yum update for ImageMagick to the latest version?
Richard
Is there a yum update for ImageMagick to the latest version?
Richard
Re: Can't create .ico files
Oh, boy..
I can't say anything about the Linux OS. But we'll need the actual JPG and ICO file if you want us to help.
I can't say anything about the Linux OS. But we'll need the actual JPG and ICO file if you want us to help.