Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

any way to colorize image ?


  • Please log in to reply
19 replies to this topic
tic
  • Members
  • 1934 posts
  • Last active: May 30 2018 08:13 PM
  • Joined: 22 Apr 2007
See my last post here:

<!-- m -->http://www.autohotke...pic.php?t=53544<!-- m -->

you can change hue, saturation etc with a simple colour matrix.
here is the header for Gdip_DrawImage in the library. look at the example matrices for an idea...

; Function                Gdip_DrawImage
; Description            This function draws a bitmap into the Graphics of another bitmap
;
; pGraphics                Pointer to the Graphics of a bitmap
; pBitmap                Pointer to a bitmap to be drawn
; dx                    x-coord of destination upper-left corner
; dy                    y-coord of destination upper-left corner
; dw                    width of destination image
; dh                    height of destination image
; sx                    x-coordinate of source upper-left corner
; sy                    y-coordinate of source upper-left corner
; sw                    width of source image
; sh                    height of source image
; Matrix                a matrix used to alter image attributes when drawing
;
; return                status enumeration. 0 = success
;
; notes                    if sx,sy,sw,sh are missed then the entire source bitmap will be used
;                        Gdip_DrawImage performs faster
;                        Matrix can be omitted to just draw with no alteration to ARGB
;                        Matrix may be passed as a digit from 0 - 1 to change just transparency
;                        Matrix can be passed as a matrix with any delimiter. For example:
;                        MatrixBright=
;                        (
;                        1.5        |0        |0        |0        |0
;                        0        |1.5    |0        |0        |0
;                        0        |0        |1.5    |0        |0
;                        0        |0        |0        |1        |0
;                        0.05    |0.05    |0.05    |0        |1
;                        )
;
; notes                    MatrixBright = 1.5|0|0|0|0|0|1.5|0|0|0|0|0|1.5|0|0|0|0|0|1|0|0.05|0.05|0.05|0|1
;                        MatrixGreyScale = 0.299|0.299|0.299|0|0|0.587|0.587|0.587|0|0|0.114|0.114|0.114|0|0|0|0|0|1|0|0|0|0|0|1
;                        MatrixNegative = -1|0|0|0|0|0|-1|0|0|0|0|0|-1|0|0|0|0|0|1|0|0|0|0|0|1

that will be able to brighten an image in less than 30ms that is 430x610 :lol:

  • Guests
  • Last active:
  • Joined: --
:idea: Suggestion for your GDI+ Voodo thread: Change hue, saturation, brightness script.

ZeLen1y
  • Members
  • 44 posts
  • Last active: Oct 13 2014 09:43 PM
  • Joined: 11 Oct 2006
yes it would be nice

ZeLen1y
  • Members
  • 44 posts
  • Last active: Oct 13 2014 09:43 PM
  • Joined: 11 Oct 2006
can someone tell me where i can read about matrix properties from tic's function :?:

tic
  • Members
  • 1934 posts
  • Last active: May 30 2018 08:13 PM
  • Joined: 22 Apr 2007

can someone tell me where i can read about matrix properties from tic's function :?:


0,0 1,0 2,0 3,0 4,0
0,1 1,1 2,1 3,1 4,1
0,2 1,2 2,2 3,2 4,2
0,3 1,3 2,3 3,3 4,3
0,4 1,4 2,4 3,4 4,4

0,0 = Multiply R values
1,1 = Multiply G values
2,2 = Multiply B values
3,3 = Multiply A values

For example, if a pixel had red component of 100 (0-255) then if 0,0 was 0.5, it would become 50, so 1/2 the redness for that pixel
By that logic, 2 will double it

Note that 1 as any of these values will keep the original value unchanged
Negative values here will invert the value, so if R=50 and you put 0,0 as -0.5 it would become 255-(50*0.5)=230

0,4 = Adjust R values
1,4 = Adjust G values
2,4 = Adjust B values
3,4 = Adjust A values

For example, if a pixel had a red component of 100 (0-255) then if 0,4 was 0.5, it would become R+(0.5*255)=R+128
Use negative numbers to subtract from the original value

Note that there is a clamp between 0 and 255, so no matter which matrix you use, the value will be between 0 and 255

Leave all other values at 0, apart from 4,4 which must be 1