[request] image files having a transparent background should be supported somehow

Bug #1306396 reported by RaiMan
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SikuliX
In Progress
Medium
RaiMan

Bug Description

from https://answers.launchpad.net/sikuli/+question/241355 comment #10:

The other issue I run into when grabbing images from products or source trees is that png's can (and often do) have transparent backgrounds. You can convert those to jpeg's and back to png's using sips, but they end up with a white background. If someone has a Mac solution, without having to use ImageMagick or something else to be downloaded, I'd be grateful for a solution.

Revision history for this message
RaiMan (raimund-hocke) wrote :

Currently the only solution/workaround is to crop the image, so that the remaining transparent pixels are reduced to a minimum (concentrate on the key visual aspects being opaque).

The current implementation based on the OpenCV feature matchTemplate does not allow images having a transparency channel - only the 3 RGB channels being taken as opaque.
So transparency information is simply ignored on the way from the given image to the OpenCV Mat object.

BTW: with Sikuli it is a best practice anyway, to take care, that an image contains as little background as possible, thus concentrating on the key visuals of the image. The more even background, the lower the resulting similarity can be.

Changed in sikuli:
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → RaiMan (raimund-hocke)
Revision history for this message
RaiMan (raimund-hocke) wrote :

one more thing:
I do not recommend, to use the conversion trail png -> jpeg -> png, because depending on the used options you may loose valuable image information, since jpeg generally is not lossless.

In most cases you will not get the original image content when converting back to png.

So if you want to get rid of the transparency channel, simply convert from png-with-transparency to png-without-transparency (in Preview just switch off the respective option, when exporting the image - might be possible with sips too)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.