How i can edit a selected image in brightness and contrast?
This not works
dplS = origImg.Duplicate();
dplS.ApplyEffectBCI(imgBrightness,100,100);
Speaking of which - I was just looking for a way to get ApplyEffectHSL working in 2021 and noticed that if you use it on a bitmap, then whatever the settings no real changes will be made. But the image will get slightly darker every time you use the macro code. So if you run something like:
Sub Ugh()Dim A As ByteFor A = 0 To 100ActiveSelectionRange.ApplyEffectHSL 0, 0, 0Next AEnd Sub
The image will get really dark. This really needs a fix...
From 2019 works like this...Sub TestBCI() ' Recorded 16/08/2021
Dim sr As ShapeRange Set sr = ActiveSelectionRange sr(1).Style.StringAssign "{""StackedBitmapEffects"":{""BCIEffect"":{""Brightness"":""-100"",""Contrast"":""0"",""Intensity"":""0""}}}"
End Sub
Edit:
Ok, I figured out how that can be done - basically create a style and then use this command:
Debug.Print ActiveDocument.StyleSheet.Styles.First.ToString
To see what it looks like:
{"HueSaturationLightnessEffect":{"Saturation":"<2>41<1>0<1>0<1>0<1>0<1>0<1>0<1>0","IncludeBlack":"0","Lightness":"<3>-65<1>0<1>0<1>0<1>0<1>0<1>0<1>0","Channel":"0","Hue":"<4>-128<1>0<1>0<1>0<1>0<1>0<1>0<1>0","PerceivedGrayscaleHue":"0"},"HueSaturationLightnessEffect_Z_Index":"0","HueSaturationLightnessEffect_Deleted":"0"}
Which you can then adapt to your needs like...
ActiveSelectionRange.Shapes.First.Style.StringAssign "{""StackedBitmapEffects"":{""HueSaturationLightnessEffect"":{""Saturation"":""<2>41<1>0<1>0<1>0<1>0<1>0<1>0<1>0"",""IncludeBlack"":""0"",""Lightness"":""<3>-65<1>0<1>0<1>0<1>0<1>0<1>0<1>0"",""Channel"":""0"",""Hue"":""<4>-128<1>0<1>0<1>0<1>0<1>0<1>0<1>0"",""PerceivedGrayscaleHue"":""0""},""HueSaturationLightnessEffect_Z_Index"":""0"",""HueSaturationLightnessEffect_Deleted"":""0""}}}"
But there is a big problem here - the effect is a Stacked Bitmap Effect as the name says - so everything becomes a large bitmap, everything slows down and it is not quite what you may expect if the plan is to change the settings differently for several objects.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Wow, thanks!
I have no idea how you got that to work, since in 2021 it is not recorded like that at all. For some reason it is incredibly slow, but still works on vector objects properly.
Could you please share what the HSL adjustment looks like? I tried to change just the names, but it must have something to select the color ranges as well so nothing works.
Tone curve data in VBA - CorelDRAW and Corel DESIGNER API - Developer Area - CorelDRAW Community