How to get image format of CatchImage()?

Just starting out? Need help? Post your questions and find answers here.
User avatar
skywalk
Addict
Addict
Posts: 4299
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

How to get image format of CatchImage()?

Post by skywalk »

How to query the format of an image after CatchImage()?
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: How to get image format of CatchImage()?

Post by srod »

What do you mean by format?

Once captured, the image is stored in an internal bitmap format regardless of whether the original file was a bmp or a jpeg etc.

However, ImageFormat() will return the format of the original file.
I may look like a mule, but I'm not a complete ass.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 5032
Joined: Sun Apr 12, 2009 6:27 am

Re: How to get image format of CatchImage()?

Post by RASHAD »

Hi skywalk

Code: Select all

   CatchImage(0,?Image_000)
   format = ImageFormat(0)
Edit :srod was very fast enough :)
Egypt my love
User avatar
skywalk
Addict
Addict
Posts: 4299
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: How to get image format of CatchImage()?

Post by skywalk »

Thanks!
I was getting an error during resizeimage().
*.ico not supported. I have to check for that before attempting resizing.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
kenmo
Addict
Addict
Posts: 2078
Joined: Tue Dec 23, 2003 3:54 am

Re: How to get image format of CatchImage()?

Post by kenmo »

I don't understand why ICOs behave differently. You can see in the help that ResizeImage(), DrawAlphaImage(), ImageOutput() etc. don't work with ICO loaded images.

Once loaded by PB, shouldn't all images behave the same?

I wrote an image viewer program, and to allow zooming ICOs I have to redraw them to a second image.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 5032
Joined: Sun Apr 12, 2009 6:27 am

Re: How to get image format of CatchImage()?

Post by RASHAD »

Hi skywalk
I did a long time back a utility to convert any image to ICON
Search the forum
If you are using Windows you can use Loadimage_() or Copyimage_() to change the Icon size in memory
So you can change the size after Catchimage()
Egypt my love
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: How to get image format of CatchImage()?

Post by srod »

kenmo wrote:I don't understand why ICOs behave differently. You can see in the help that ResizeImage(), DrawAlphaImage(), ImageOutput() etc. don't work with ICO loaded images.

Once loaded by PB, shouldn't all images behave the same?

I wrote an image viewer program, and to allow zooming ICOs I have to redraw them to a second image.
Well, icons are natively supported by Windows and come with their own AND/XOR masks and color tables etc. which differentiates them from a single DIB for example. As soon as you draw an icon to a DIB, you lose a lot of the information embedded within the various masks. In this regards I can understand why PB treats them slightly differently since the Win API has functions exclusively for use with icons and cursors and so we are free to use these APIs with native icons loaded through PB if we so wish. Having said this, I guess a LoadIcon() in place of LoadImage() might make sense, but then LoadIcon() would be of no use on the other platforms.
I may look like a mule, but I'm not a complete ass.
Post Reply