LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to magnify a picture ?

Solved!
Go to solution

Hi,

 

I'm trying to develop a vi that loads a .jpg picture from the hard disk, makes it bigger or smaller according to the zoom factor selected and then adds it to into an existing picture. In short it's a tool to add icons with selected size and position into an existing picture (see the attached vi and picture).

 

I used the zoom factor property to set the size of the loaded image. But I didn't find a way to insert the zoomed picture into the output picture. Instead I get the loaded picture in the position I chose in the new picture, but in its original size...

 

Is there some kind of tool/method/property/algorithm I can use to do this operation ?

I think this is not too straight forward so I'd appreciate any help....

 

Mentos. 

Download All
0 Kudos
Message 1 of 9
(3,867 Views)
Solution
Accepted by topic author Mentos
I have written a set of tools that lets me scale/rotate all of the contents of a picture.  That is a bit too much to post, here is a piece which does scaling on 24 or 32 bit images without masks.  Feed it the image data which you get from many of the picture VIs and give it x and y scale factors.  Remember not to expect great things when scaling a picture up too far.
Message 2 of 9
(3,828 Views)

Thanks Darin,

 

This is exactly what I was looking for!!!

 

This is indeed a great help.

 

Much applause!

 

 

Mentos

0 Kudos
Message 3 of 9
(3,808 Views)

Hi Darin,

 

I need to scale pictures like the one attached to about 10-20 percent of its original size.

When I tried to do this with your vi the resolution I get is too low (I need to print the scaled picture...).

 

Is there any way I can manipulate this vi to get higher resolution/clear picture when scaling to this small ratios ?

Can I also change this vi to use bmp files ?

 

BR,

Mentos.

0 Kudos
Message 4 of 9
(3,763 Views)
Here's the example icon I need to scal (I forgot to add it in my last reply).
0 Kudos
Message 5 of 9
(3,762 Views)

If you need serious manipulations I suggest a package such as GIMP, this code is meant for simple scaling for bitmaps which will remain at screen resolution.  A few suggestions:

 

Do not try to reduce in one step, for this case I suggest 3 reductions by 0.5 for a final scaling of 0.125.  Use a for loop with a shift register.

 

As for getting things print-quality, remember that your screen is 72-96 dpi and that you will be printing at roughly 300 dpi, unless you are using a program that is designed for this purpose, this conversion does not often end up well for bitmaps.  

 

As for BMP files, no problem, just use Read BMP file instead of Read JPEG, same for PNG.  The same flattened data works. 

Message 6 of 9
(3,740 Views)

Hi Darin,

 

I'm not familiar with the GIMP package.

 

Do you have any idea if it can be controled from Labview (via active-x, some kind of driver etc....)?

0 Kudos
Message 7 of 9
(3,728 Views)
What I have done is use LabVIEW to write a script file, call GIMP from the command line and then open the generated file. 
Message 8 of 9
(3,723 Views)

It looks like the question was asked in this thread also and answered there.

 

The subject of this thread is a little misleading.  I wouldn't call it magnifying a picture but reducing a picture.

0 Kudos
Message 9 of 9
(3,701 Views)