Image.Rotate: " If the image has a mask, then the mask colour is used
for the uncovered pixels in the rotated image background. Otherwise,
black will be used as the fill colour."
import wx
class Frame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title="blarf")
self.image = wx.Image('sv.png')
if not self.image.HasAlpha():
self.image.InitAlpha()
self.image.ConvertAlphaToMask()
R, G, B = image.FindFirstUnusedColour()
# or GetOrFindMaskColour perhaps
image.SetMaskColour(R, G, B)
···
On 5/6/10 11:35 PM, Steven Sproat wrote:
Image.Rotate: " If the image has a mask, then the mask colour is used
for the uncovered pixels in the rotated image background. Otherwise,
black will be used as the fill colour."
The saved image has a black 'rotation rectangle' around the image.
How do I go about creating a suitable mask for any image that a user may
load? I don't want to choose a colour myself, e.g. white
Image.Rotate: " If the image has a mask, then the mask colour is used
for the uncovered pixels in the rotated image background. Otherwise,
black will be used as the fill colour."
The saved image has a black 'rotation rectangle' around the image.
How do I go about creating a suitable mask for any image that a user may
load? I don't want to choose a colour myself, e.g. white
R, G, B = image.FindFirstUnusedColour()
# or GetOrFindMaskColour perhaps
image.SetMaskColour(R, G, B)
Hi Rob,
I'm still getting the black fill in the "rectangle" of the rotation.
import wx
class Frame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title="blarf")
self.image = wx.Image('sv.png')
R, G, B = self.image.GetOrFindMaskColour()
self.image.SetMaskColour(R, G, B)
img = self.image.Rotate(45, (50, 50))
Sorry, I didn't notice that you were using JPEG before. The JPEG image file format does not support saving masks or alpha channel information, so the mask colour chosen by wx.Image is just being written to the file as that colour.
···
On 5/7/10 11:46 AM, Steven Sproat wrote:
Robin Dunn wrote:
On 5/6/10 11:35 PM, Steven Sproat wrote:
Image.Rotate: " If the image has a mask, then the mask colour is used
for the uncovered pixels in the rotated image background. Otherwise,
black will be used as the fill colour."
The saved image has a black 'rotation rectangle' around the image.
How do I go about creating a suitable mask for any image that a user may
load? I don't want to choose a colour myself, e.g. white
R, G, B = image.FindFirstUnusedColour()
# or GetOrFindMaskColour perhaps
image.SetMaskColour(R, G, B)
Hi Rob,
I'm still getting the black fill in the "rectangle" of the rotation.
one fix is to save as PNG but that creates some very large files
compared to JPGs (in photographs, for example)
Image.Rotate: " If the image has a mask, then the mask colour is used
for the uncovered pixels in the rotated image background. Otherwise,
black will be used as the fill colour."
The saved image has a black 'rotation rectangle' around the image.
How do I go about creating a suitable mask for any image that a
user may
load? I don't want to choose a colour myself, e.g. white
R, G, B = image.FindFirstUnusedColour()
# or GetOrFindMaskColour perhaps
image.SetMaskColour(R, G, B)
Hi Rob,
I'm still getting the black fill in the "rectangle" of the rotation.
one fix is to save as PNG but that creates some very large files
compared to JPGs (in photographs, for example)
Sorry, I didn't notice that you were using JPEG before. The JPEG
image file format does not support saving masks or alpha channel
information, so the mask colour chosen by wx.Image is just being
written to the file as that colour.
ah alright then, thank you. I think I'll stick to white, then.
Cheers again, hopefully I can get my new version of my program released
this weekend - I've been stuck with this problem for a long time.