Project

General

Profile

How to get the size of an WImage?

Added by Ezgi Cicek about 14 years ago

I am trying to get the size of an WImage that has a file resource from local directory.

WImage * image;

// assuming I have set the resource in fileUploaded()

then

image->width().toPixels() doesnt give me the width.

What should I do to get the width and height of my WImage?


Replies (1)

RE: How to get the size of an WImage? - Added by Koen Deforche about 14 years ago

Hey,

The server isn't actually aware --- only the browser is.

There is a small utility that we use (in WPainter) to read the size of a PNG or GIF file.

You can use it like this:

WPainter::Image::Image image(fileName, fileName);
std::cerr << image.width() << ", " << image.height() << std::endl;

Regards,

koen

    (1-1/1)