Quantcast
Channel: Daz Script Developer Discussion - Daz 3D Forums
Viewing all articles
Browse latest Browse all 1036

scaling an image within a pixmap

$
0
0

Hello everyone!

I'm trying to add in a dialog several pixmaps with images loaded somewhere else in the script. This is not fundamental, but this would be "much more cute" this way (gosh, it's always like this when women are scripting?!).

For now I have no issue to add the pixmap with the "big" image, my issue is the scale of the initial images. In general they are big images (>2000x2000) that I want to fit in a 200x200 pixmap (the pixmap supported by a DzLabel in the dialog : "wLabel.pixmap").

So far I tried :

- to use the Qt commands : scaledToWidth/ scaledToHeight but I failed

- the pixmap.resize(size), which crops the image, (well it does what it supposed to do : resize the pixmap, not the image)

- to load the file as an image "Image(sAbsolutePath)", rescale it, and place it directly in the pixmap, but this method does not seem to be supported (pixmap seems to need a path to be loaded). I tried the Qt function fromImage() to create the function from the image but once again I did not manage to use it.

- to load the file as an image "Image(sAbsolutePath)", rescale it, save it, and then the pixmap calls the image just saved. This could be the solution, my worry is being that I will have to save it, probably in a temp folder, and I don't know how to grab the temp folder of the user, and if I have to clean it or not at the end of the script.

Finally I decided to come here to ask the questions about what is the best way to rescale an image to place in a PixMap. Or maybe is there another solution, something else than the pixmap?

If there is no other solution, I guess I'm supposed to write temporary images in the "temp" file of the user, but is there a way to access the path of this file?

Thanks in advance for any help!

 


Viewing all articles
Browse latest Browse all 1036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>