LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scaling JPEGs to fit into picture control

Hallo NG,

I have a frontpanel with a fixed sized picture-control where I want to
display a JPEG-Image.
I use the ReadJPEG and DrawFlattenedPixmap to display. Now, if my JPEG is of
bigger size than my picture control, the rest of the image gets clipped.
How can I scale a JPEG image to fit it into the control. If the control and
the image have different aspect ratios, that's OK, I could scale it down
with fixed ratio, and leave parts of the control blank.
So again: How can I scale the images, is it possible with those two VIs
mentioned above or do I have to make it more low-level and complex ?

Oliver
0 Kudos
Message 1 of 9
(9,164 Views)
Hi Oliver

I recently had a similar problem. I solved it the follwing way: the picture is displayed "draw flattened pixmap" in "new picture". and to this "new picture" I have referred a porperty node with "draw area size" where you can set the size of the displayed image.
Hope this could help you.
Yves
0 Kudos
Message 2 of 9
(9,164 Views)
"Yves" schrieb im Newsbeitrag
news:506500000005000000E1450000-1002247793000@exchange.ni.com...
> Hi Oliver
>
> I recently had a similar problem. I solved it the follwing way: the
> picture is displayed "draw flattened pixmap" in "new picture". and to
> this "new picture" I have referred a porperty node with "draw area
> size" where you can set the size of the displayed image.
> Hope this could help you.
> Yves

No, that's not the trick. AFAIK DrawAreaSize changes the size of the picture
control, but not the size of the displayed image. Anyway, parts of my image
would be clipped away.
At the moment, I'm thinking of unflatten the data into 2D-array and make
some scaling-transformation on this array. But before inventing the wheel
twice,
any solutions out there ?

Oli
0 Kudos
Message 3 of 9
(9,164 Views)
Oliver;

I did a quick research on Developer Exchange. If you have IMAQ, it should be very easy. IMAQ already has functions to resize a picture, as alberto posted on 6/7/2001,/a> to a similar question.


Anthony de Vries posted on 8/16/2001 what can be called a "quick and dirty" approach. With his approach you may sacrifice resolution or even details of your image, though.


Other than that, everything point that you must write your code. Joseph Oravec posted on 9/8/2000 a possible method.

I am not sure, but I think somebody did this and has the vi's available, maybe for a fee.

Hope you are succesful;
Enrique

www.vartortech.com
0 Kudos
Message 4 of 9
(9,164 Views)
Hi Oliver

I still believe my hint should work. I have attached a VI where a picture is taken using a Hauppage-TV-card and micro-modul-camera.
Yves
0 Kudos
Message 5 of 9
(9,164 Views)
Is it an option for you to display in an intensity graph? That would scale the
picture automatically.

-Franz

Oliver Friedrich schrieb:

> Hallo NG,
>
> I have a frontpanel with a fixed sized picture-control where I want to
> display a JPEG-Image.
> I use the ReadJPEG and DrawFlattenedPixmap to display. Now, if my JPEG is of
> bigger size than my picture control, the rest of the image gets clipped.
> How can I scale a JPEG image to fit it into the control. If the control and
> the image have different aspect ratios, that's OK, I could scale it down
> with fixed ratio, and leave parts of the control blank.
> So again: How can I scale the images, is it possible with those two VIs
> mentioned above or do I have to make it more low-level and complex ?
>
> O
liver
0 Kudos
Message 6 of 9
(9,164 Views)

Hello,

Picture Controls have a property called "ZoomFactor".

Sletrab

Message 7 of 9
(8,329 Views)

I know it is old, but came up first when searching for the answer.

For those who need a working solution, here is one by "Knight of NI":

http://forums.ni.com/t5/LabVIEW/How-to-Resize-a-picture/td-p/246785

 

0 Kudos
Message 8 of 9
(5,373 Views)

A solution I prefer to use involves .NET and a GDI Resize, this method supports many file formats, and bit depths, and seems pretty quick when .NET can be used.

 

http://forums.ni.com/t5/LabVIEW/Net-image-resize-how-to-convert-to-format-labview-can-use/m-p/219902...

 

I used it in my quick drop show VIs, to scale VI icons to fill the window size.

 

https://decibel.ni.com/content/docs/DOC-31302

0 Kudos
Message 9 of 9
(5,358 Views)