Jump to content

Image rotation


Recommended Posts

Hi Guys,

I am writing a VI will when run, will enable me to rotate an image. Right now this is what I am working on:

1. Image -> Pixmap (using Picture to Pixmap VI)

2. Pixmap -> 2D array (using Unflatten Pixmap VI)

3. 2D array to -> Pixmap (using Flatten Pixmap VI)

4. Pixmap -> Picture (using Pixmap to Picture VI)

The problem I am facing is that if my picture has in it "Hello", the output is hello, yet the background fill of the picture has gone from the original colour (transparent) to black. I was wondering why this occurs, especially since I'm not rotating the picture as of yet, there shouldn't be a change in the pixels.

Further investigation leads me to think that there might be something in last stage of the processing (stage 4). I am attaching the VI in question. Hope some one can point me in the right direction.

Regards,

Rotate Simple Image_2.vi

Link to comment

You loose transperency in both 1st and 4th stage. In 1st because "Picture to Pixmap" stores transparency only in 4th byte of 32-bit image data, not in the mask. You have to manually convert this data to mask and perform your operations on the mask as well. But I've noticed that the transparency data generated by "Picture to Pixmap" in not compatibile to similar data generated by "Load PNG"... Bug? I have to do more testing on this. If you know something about the image you may generate mask yourself from color image data (i.e. using "Create Mask").

I would reccomend you using my BitMan library which helps with such situations and perform all operations on transparency automaticly.

post-7450-124833795601_thumb.png

post-7450-124833796497_thumb.png

  • Like 1
Link to comment

Hi Vugie,

Thanks for the information and the screenshots. I did download BitMan and I created a VI. I am attaching the screen shot of what happens below.

Any idea why I get a white background?

Edit: Helps if I actually attach the file :-)

post-16132-124839637472_thumb.jpg

Edited by nigeekaus
Link to comment

Hi Vugie,

Thanks for the information and the screenshots. I did download BitMan and I created a VI. I am attaching the screen shot of what happens below.

Any idea why I get a white background?

Edit: Helps if I actually attach the file :-)

Because picture control has such :)

On the front panel you have to switch to set color tool, right-clik on picture control and select transparent color (upper-right corner, marked with T)

And the angle for rotation should be in radians

proba transp.vi

Edited by vugie
  • Like 1
Link to comment
  • 4 years later...
You loose transperency in both 1st and 4th stage. In 1st because "Picture to Pixmap" stores transparency only in 4th byte of 32-bit image data, not in the mask. You have to manually convert this data to mask and perform your operations on the mask as well. But I've noticed that the transparency data generated by "Picture to Pixmap" in not compatibile to similar data generated by "Load PNG"... Bug? I have to do more testing on this. If you know something about the image you may generate mask yourself from color image data (i.e. using "Create Mask").

I would reccomend you using my BitMan library which helps with such situations and perform all operations on transparency automaticly.

attachicon.giftranspbd.png

attachicon.giftranspfp.png

 

Thanks a lot. This was very helpful for me!

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.