LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Resize a picture

generate preview.png

 Original:

PincoG_1-1682496892119.png

Produced by my preview:

PincoG_2-1682496961760.png

Where is the colors table I lost?

Thankyou to everyone.

It's still a result since the Clipboard.GetImage is still not working in an .exe file (Labview 2021)

Greetings

0 Kudos
Message 21 of 30
(700 Views)
0 Kudos
Message 22 of 30
(690 Views)

So your issue isn't with the resizing code, but rather with how you get the image. You use Rolf's VIs to get the image from the clipboard, which can be assumed to be good. That said, they are old and it's possible there were changes to formats or how the clipboard is handled since they were written.

 

 

Edit: I just saw that you're using the 8 bit image output from the unflatten VI and the resize VI probably expects a 2D U32 array (you can see that there is a coercion dot) and that's probably also what it outputs. When you feed it into the draw unflattened pixmap VI you get the 32 bit instance which doesn't have the colors input. You should change the resize VI to use U8 arrays and then feed the color table into the new input you get. Only if this isn't the issue, look at the rest of the message.

 

I would start by looking at where you get data into the clipboard from and checking whether it arrives with a defined format. I would also look at the hex values you get from the color table, to see if there is any swapping going on in the RGB values, as zou suggests. Seems a bit weird when going from white to a dark blue, but might still be possible and it's possible this can be handled simply by swapping the bytes.

 

If that doesn't help, I would look to see if there's a way of reading the image from the clipboard using .NET.

 

Besides all that, earlier comments suggest that there are resizing implementations available which are better than the one I originally posted, including in this thread, so I would suggest using those.


___________________
Try to take over the world!
0 Kudos
Message 23 of 30
(682 Views)

PincoG_0-1682576853173.png

 

Not so much better, the resize is using 8bit array data.

Maybe the problem is the color table originally produced by CLIP Read by Rolf?

Has already said I did'nt found another way to copy the clipboard, since the Clipboard.GetImage method does not work in an .exe file.

Actually the color table produced by this code is a bit weird.

Not many greys, a lot of black.

Any advice?

Thanks

CLIP Read.png

 *tst: I did not understand what are the resizing vi in this thread you are talking about.

0 Kudos
Message 24 of 30
(660 Views)

It might be easier to this using .Net Framework.

 

George Zou
0 Kudos
Message 25 of 30
(636 Views)

Thankyou George,

and then, from .net picturebox to labview image?

0 Kudos
Message 26 of 30
(624 Views)

Dear George,

ok, copy from clipboard it's easier with dotnet than using Rolf's routine,

but the result it's the same:

so now I know that the color shift happen in the resize part of the code, or passing from flatten to unflattened picture.

Now I need to change the resize part of the code.

0 Kudos
Message 27 of 30
(619 Views)

Again, you should include all the code you use (You can use File>>Save for previous, which will include all the dependencies, or create a source distribution build spec in the project), as well the actual data you're working with (you can create an indicator from the data you got from the clipboard and then change it to a constant), because otherwise it's just a guessing game.


___________________
Try to take over the world!
0 Kudos
Message 28 of 30
(615 Views)

Sorry Tst,

I did not include again the code just because it's still the same in the resize part:

generate preview.png

But just now I found a workaround that's ok for me: the error seems to be present only on the 8bit images.

I will try to go on like that

0 Kudos
Message 29 of 30
(607 Views)

Back on image resizing huh. I forgot all about this thread. Good someone else is finding good use of it. I almost forgot what i needed this for.

 

-pRoFiT

0 Kudos
Message 30 of 30
(579 Views)