Page 4 of 4
Re: Imagen() : A fade-in/fade-out animator for picture control
Posted: 27 Jan 2022, 11:44
by Chappier
I tested with an image 1920x1080 286KB
https://i.imgur.com/F7t62UU.jpeg
when I save the bitmap it's now 2.47MB.
I just put a
Return pBitmap before the function disposing it.
Code: Select all
pBitmap := Imagen("C:\picture.png", "?Normal:" 155 " BackGroundTrans")
Gdip_SaveBitmapToFile(pBitmap, "file.png", 100)
Return
I'm NOT saving the pictures to disk, I saved this time just to check the size.
I'm keeping some
hbitmaps in memory to speed up and reduce CPU use, but it's using like 400MB of RAM.
I tried to resize the bitmap after setting transparency with Imagen with a different pixel format, but it lost the transparency;
What do you recommend to reduce the size of the
hbitmaps stored in
memory?
Re: Imagen() : A fade-in/fade-out animator for picture control
Posted: 27 Jan 2022, 12:06
by SKAN
(1920x1080) * 4 bytes per pixel + 54 bytes header would take 8294454 bytes (7.9 MB) to save your image in BMP format.
It doesn't matter if you are loading a PNG or JPG, (1920x1080, 32 bpp) will consume at least 8294400 bytes in memory.
Saving to disk and checking doesn't tell you the facts.
I'm NOT saving the pictures to disk, I saved this time just to check the size.
I'm keeping some hbitmaps in memory to speed up and reduce CPU use, but it's using like 400MB of RAM.
I tried to resize the bitmap after setting transparency with Imagen with a different pixel format, but it lost the transparency;
What do you recommend to reduce the size of the hbitmaps stored in memory?
I'm not sure, maybe your code is leaking resources.
Re: Imagen() : A fade-in/fade-out animator for picture control
Posted: 28 May 2022, 07:58
by Galaxis
@SKAN How do you make the white background invisible/clear?
For example, if I wanted to two blue squares to appear like a splash image on my desktop, but not look as if it's in a window?
Can Imagen do that?
SKAN wrote: ↑09 Feb 2021, 03:07
tuzi wrote: ↑17 Jan 2021, 10:27
@SKAN
It seems to be a bug.
When I use the fade-out effect, the pic control always has a background color.
I want it to be transparent.
Hi @tuzi
I'm sorry for the late reply.
This is not a bug but a limitation.
Semitransparent pixels shouldn't be rendered more than once.. and hence background color is forced to make them opaque.
In other words.
- Fully opaque pixels can be faded in-out.
- Fully transparent pixels can be faded in-out.
- Semi-transparent pixels will blot.
Here follows a demo where 2
blue bitmaps (50% transparent) are overlapped.
You can see that the blue becomes 100% where the overlap occurs. The white background also seeps through as a grey within the blue.
image.png
Code: Select all
#NoEnv
#SingleInstance, Force
hBM1 := DllCall("CreateBitmap", "Int",1, "Int",1, "Int",1, "Int",32, "IntP",0x790000FF, "Ptr")
hBM2 := DllCall("CreateBitmap", "Int",1, "Int",1, "Int",1, "Int",32, "IntP",0x790000FF, "Ptr")
Gui -MinimizeBox
Gui, Color, FFFFFF
Gui, Add, Picture, w128 h128 BackgroundTrans, HBITMAP:%hBM1%
Gui, Add, Picture, x69 y69 w128 h128 BackgroundTrans, HBITMAP:%hBM2%
Gui, Show,,Semi-transparent pixels
Re: Imagen() : A fade-in/fade-out animator for picture control
Posted: 06 Apr 2024, 01:09
by Spark
any V2 for this function?