LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert AIPD Image to JPEG?

Hi everyone,
 
I am having problems with (what I thought to be) a simple task.  Using IMAQ Vision package, I want to convert a greyscale (SGL) "*.AIPD" Image to a JPEG.  I will post the code that I thought would work, but I'm obviously not understanding something fundamental to the images because it doesn't work and is giving me..'wrong image type'. 
 
I'm stuck, again, and appreciate any help.
 
Thanks,
 
Jonathan
0 Kudos
Message 1 of 10
(3,448 Views)
Here's an example .AIPD Image to work with.... (had to compact it cause server didn't recognize extension).  By adding a simple IMAQ image display to that .vi you can see the image

Message Edited by IEC on 09-12-2006 03:58 PM

0 Kudos
Message 2 of 10
(3,441 Views)
Jonathon
 
Try building your VI like this
 
 
and see if this works for you.
 
cheers
 
David

Message Edited by David Crawford on 09-12-2006 09:55 PM

Message 3 of 10
(3,433 Views)
David,
 
No, sorry, that gives the same error:
'd:-1074396080'
'IMAQ WriteJPEGFile
  Invalid image type.'
 
0 Kudos
Message 4 of 10
(3,416 Views)

Thats weird it worked OK for me. Try it without using the image type enums.

David

0 Kudos
Message 5 of 10
(3,409 Views)
Jpeg is 24 bit image by default.  So you might have to convert image type.
Or simply use bitmap instead of jpeg.
 
George Zou
 
George Zou
0 Kudos
Message 6 of 10
(3,407 Views)
Good afternoon IEC,

The problem is that the Write JPEG File.VI only supports U8 and U32 image data types.  If you change the U64 enums to U32, then your VI works perfectly!

Cheers,
Message 7 of 10
(3,396 Views)

I tried doing it this way, it worked, though the image was completely black.  This says to me that all of the values from the U64 are too small (which they are, they are all <<1).  Is there a simple way to scale the values to the appropriate range before writing the jpeg? if not, does anyone know what range they should be in so I can do it manually?

 

THanks,

 

Jonathan

0 Kudos
Message 8 of 10
(3,390 Views)

I have it working, actually, I just need to know one thing more... how do I generate a 'color palette' to use when saving as a jpeg/tiff/etc... from the color palette choices available.   Check the image to see what I mean.

 

Thanks for all the help!

0 Kudos
Message 9 of 10
(3,386 Views)
IEC,
 
You can use the IMAQ GetPalette VI to generate a color palette for the IMAQ Write TIFF File VI.  It is in the Vision and Motion >> Vision Utilities >> External Display palette.  Please let me know if this is what you are looking for.
 
Chris
Applications Engineer
National Instruments
0 Kudos
Message 10 of 10
(3,349 Views)