Change sharpness and brightness of a selected picture
-
- 5StarLounger
- Posts: 961
- Joined: 09 Feb 2010, 00:33
- Location: Patterson Lakes, Victoria, Australia
Change sharpness and brightness of a selected picture
Would anyone know how to change the sharpness and brightness of a selected picture using Word vba?
Avagr8day, regards, Peter
-
- Administrator
- Posts: 77256
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Change sharpness and brightness of a selected picture
For example:
Code: Select all
Sub PictureTest()
With ActiveDocument.InlineShapes(1)
With .PictureFormat
.Brightness = 0.6
.Contrast = 0.4
End With
.Fill.PictureEffects.Insert(msoEffectSharpenSoften).EffectParameters(1).Value = 0.3
End With
End Sub
Regards,
Hans
Hans
-
- 4StarLounger
- Posts: 442
- Joined: 14 Nov 2012, 16:06
Re: Change sharpness and brightness of a selected picture
When already selected:
Code: Select all
Sub M_snb()
With Selection.ShapeRange.PictureFormat
.Brightness = 0.5
.Contrast = 0.5
.Parent.Fill.PictureEffects.Insert(25).EffectParameters(1).Value = 0.5
End With
End Sub
-
- 5StarLounger
- Posts: 961
- Joined: 09 Feb 2010, 00:33
- Location: Patterson Lakes, Victoria, Australia
Re: Change sharpness and brightness of a selected picture
Oh dear, I completely missed your reply Hans - sorry. No idea how that happened.
The above Sub changes Sharpness to 75% - great; Brightness to -60% - not great; Contrast to -100% - not great.
The first line of the Sub M_snb() produces the error "Invalid procedure call"
Code: Select all
Sub PictureTest()
With ActiveDocument.InlineShapes(1)
With .PictureFormat
.Brightness = 0.2
.Contrast = 0
End With
.Fill.PictureEffects.Insert(msoEffectSharpenSoften).EffectParameters(1).Value = 0.75
End With
End Sub
The first line of the Sub M_snb() produces the error "Invalid procedure call"
Avagr8day, regards, Peter
-
- 5StarLounger
- Posts: 961
- Joined: 09 Feb 2010, 00:33
- Location: Patterson Lakes, Victoria, Australia
Re: Change sharpness and brightness of a selected picture
Played around and got it working. Why, oh why did I change your values.

Code: Select all
Sub FixPic()
Dim Num As Integer
Num = ActiveDocument.InlineShapes.Count
For x = 1 To Num
With ActiveDocument.InlineShapes(x)
With .PictureFormat
.Brightness = 0.6
End With
.Fill.PictureEffects.Insert(msoEffectSharpenSoften).EffectParameters(1).Value = 0.75
End With
Next 'x
End Sub
You do not have the required permissions to view the files attached to this post.
Avagr8day, regards, Peter