You could use some other image utility to convert the file to some format other than .ico such as .png, and then run img2py on that. It's possible that there are more than one version of the image in the .ico file and that the conversion path that img2py uses is getting confused by that and converting the wrong one. Using different utility to do the conversion will give you more control over the process.
···
On 2/28/12 10:10 AM, Michael Hipp wrote:
I have a 16x16 .ico file I want to use for a tiny button. When I load it
from the file it works:
Using various image editing tools and convert to png, jpg, gif does indeed fix the sizing issue. But it also messes up the transparency qualities and such. After much fiddling I found a tool that would keep the transparency while converting to .gif. So my immediate problem seems to be solved.
But I'm gonna suggest that this is a bug. Three different icon editor tools all report a single icon in this file of 16x16 as spec'd. So whatever is resizing it (img2py?) should not be doing so.
Thanks,
Michael
···
On 2012-02-28 12:36 PM, Robin Dunn wrote:
On 2/28/12 10:10 AM, Michael Hipp wrote:
But when I do img2py on it and load it that way it gets resized about 4x
larger and looks really awful.
You could use some other image utility to convert the file to some format other
than .ico such as .png, and then run img2py on that. It's possible that there
are more than one version of the image in the .ico file and that the conversion
path that img2py uses is getting confused by that and converting the wrong one.
Using different utility to do the conversion will give you more control over
the process.
You should submit a bug report along with a sample icon file so the wx guys can figure out what the deal is.
Mike
···
On Tuesday, February 28, 2012 1:24:43 PM UTC-6, Michael Hipp wrote:
On 2012-02-28 12:36 PM, Robin Dunn wrote:
On 2/28/12 10:10 AM, Michael Hipp wrote:
But when I do img2py on it and load it that way it gets resized about 4x
larger and looks really awful.
You could use some other image utility to convert the file to some format other
than .ico such as .png, and then run img2py on that. It’s possible that there
are more than one version of the image in the .ico file and that the conversion
path that img2py uses is getting confused by that and converting the wrong one.
Using different utility to do the conversion will give you more control over
the process.
Using various image editing tools and convert to png, jpg, gif does indeed fix
the sizing issue. But it also messes up the transparency qualities and such.
After much fiddling I found a tool that would keep the transparency while
converting to .gif. So my immediate problem seems to be solved.
But I’m gonna suggest that this is a bug. Three different icon editor tools all
report a single icon in this file of 16x16 as spec’d. So whatever is resizing
it (img2py?) should not be doing so.
What component do I flag the bug to? img2py? wxBitmap? PyEmbeddedImage?
Thanks,
Michael
···
On 2012-02-28 2:35 PM, Mike Driscoll wrote:
On Tuesday, February 28, 2012 1:24:43 PM UTC-6, Michael Hipp wrote:
But I'm gonna suggest that this is a bug. Three different icon editor tools
all
report a single icon in this file of 16x16 as spec'd. So whatever is resizing
it (img2py?) should not be doing so.
You should submit a bug report along with a sample icon file so the wx guys can
figure out what the deal is.
If you can narrow down the problem a little it would help. For example try each of the following steps and see where the size goes wrong:
1. load the file using wx.Icon(filename)
2. convert icon to bitmap with wx.BitmapFromIcon
3. convert bitmap to image with wx.ImageFromBitmap
4. save image to file with image.SaveFile(newFilename, wx.BITMAP_TYPE_PNG)
etc.
By finding where the problem starts will help how to categorize and label the ticket.
···
On 2/28/12 12:56 PM, Michael Hipp wrote:
On 2012-02-28 2:35 PM, Mike Driscoll wrote:
On Tuesday, February 28, 2012 1:24:43 PM UTC-6, Michael Hipp wrote:
But I'm gonna suggest that this is a bug. Three different icon editor
tools
all
report a single icon in this file of 16x16 as spec'd. So whatever is
resizing
it (img2py?) should not be doing so.
You should submit a bug report along with a sample icon file so the wx
guys can
figure out what the deal is.
What component do I flag the bug to? img2py? wxBitmap? PyEmbeddedImage?
Did the above steps and it dutifully reports the size to be (16,16) as expected, including the file saved at the end. So I don't know where the problem is other than it must be in the img2py -> PyEmbeddedImage transition.
Anyway, I have attached a sample app that shows the problem. I've included the source .ico and .png files for reference.
Could you take a look and give me some more hints? My immediate problem has been solved, but I'd like to be able to file a (useful) bug report.
What component do I flag the bug to? img2py? wxBitmap? PyEmbeddedImage?
If you can narrow down the problem a little it would help. For example try each
of the following steps and see where the size goes wrong:
1. load the file using wx.Icon(filename)
2. convert icon to bitmap with wx.BitmapFromIcon
3. convert bitmap to image with wx.ImageFromBitmap
4. save image to file with image.SaveFile(newFilename, wx.BITMAP_TYPE_PNG)
etc.
By finding where the problem starts will help how to categorize and label the
ticket.