-
Nov 27th, 2020, 03:13 PM
#1
Thread Starter
New Member
[RESOLVED] Pré-multiplying images
Hello friends,
After pre-multiplying the image of the globe with the mask, and drawing it on the canvas, there is a dark shadow around the image, how can I remove the dark shadow and leave only the blue light of the golobo ?, And how to save this image in transparent png?, Thank you.
Note: Code attached.
Pré-multiplying images.zip
Last edited by Pix_Man; Nov 27th, 2020 at 03:51 PM.
-
Nov 27th, 2020, 07:50 PM
#2
Re: Pré-multiplying images
Your mask already contains "the gaussian-blurred masking-area".
So there's no reason, why your original image should contain an "already Cyan-ish masked against Black" conture...
Just let the mask(-image) do its job - and try it with this simpler image in your Source (picImg.Picture):
The above should be "copyable" (downloadable as a JPG) in the same size as your images (200x200).
HTH
Olaf
-
Nov 28th, 2020, 04:05 AM
#3
Re: Pré-multiplying images
Your image is already pre-multiplied.
This works
Code:
For x = 0 To bmi.bmiheader.biWidth * bmi.bmiheader.biHeight * 4 - 1 Step 4
' pix = BBYTES(x + 0): pix = pix * ABYTES(x) / 255: BBYTES(x + 0) = pix
' pix = BBYTES(x + 1): pix = pix * ABYTES(x) / 255: BBYTES(x + 1) = pix
' pix = BBYTES(x + 2): pix = pix * ABYTES(x) / 255: BBYTES(x + 2) = pix
BBYTES(x + 3) = ABYTES(x)
Next
(Skip pre-multiplying, only copy alpha)
cheers,
</wqw>
-
Nov 28th, 2020, 07:56 AM
#4
Re: Pré-multiplying images
Originally Posted by wqweto
Your image is already pre-multiplied.
Yep - and the step which produced that "original, premultiplied image" -
was apparently already using "existing alpha-information" in that pre-multiplying-stage...
And at this occasion could already have stored the used AlphaMask-bytes in the first place:
- within the "4th-Byte" of a 32bpp-DIB target
- and afterwards saving the whole thing as either a 32bpp *.bmp (or alternatively as a *.png).
Afterwards no Extra-Masking steps (via special Mask-bitmaps) would be needed anymore ...
The 32bpp *.bmp would be directly loadable - and "AlphaBlend-Blittable".
So the OP is good advised, to reconsider his whole "workflow"...
- from the "design-phase" - and what output it should produce
- to the "usage-phase" within a given CodeBase
Blending-Ops which require the managing of two separate Resources (Input-Files) to become usable,
are (IMO) a thing of the past.
Olaf
-
Nov 28th, 2020, 09:52 AM
#5
Thread Starter
New Member
Re: Pré-multiplying images
Thank you very much Olaf and wqweto
Last edited by Pix_Man; Nov 30th, 2020 at 05:53 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|