Prevent duplication after image processing
Hi,
i am using a macro which applies different filters, masks and operation to an image.
At each step its create a new image, how can I avoid that and apply each step on the same image?
here are some line of the code :
i am using a macro which applies different filters, masks and operation to an image.
At each step its create a new image, how can I avoid that and apply each step on the same image?
here are some line of the code :
With Adjust.ImageCommands.Duplicate(x10_segmentation)
.Name = "_2_Sub_Low-Pass"
.Visible = True
.Run(doc1, image1)
End With
With Process.Filter.EnhancementCommands.LowPass(x10_segmentation)
.Text = "Low-Pass"
.Passes = 1
.KernelSize = Filters.mcKernelSize.mcks7x7
.Strength = 100
.Run(image1, image1)
End With
With Measure.SmartSegmentation.RecipeCommands.Open(x10_segmentation)
.FileName = "C:\Users\Public\Documents\Image-Pro Premier 9.1 64-bit (Shared)\Project segmentation\Segmentation x10.isg"
.FilterIndex = 1
.Settings = Nothing
.FilterInput = True
.Run(image1)
End With
With Measure.SmartSegmentationCommands.CreateMask(x10_segmentation)
.FilterInput = True
.Run(image1, image1)
End With
With Application.DocumentCommands.Activate(x10_segmentation)
.Run(image1, doc1)
End With
With Adjust.ImageCommands.Convert(x10_segmentation)
.Destination = Image.ConvertTypes.RGB24
.ConvertOption = Image.ConvertOptions.Scale
.Visible = True
.Run(doc1, image1)
End With
With Process.ProcessCommands.Operations(x10_segmentation)
.Operation = eOperation.Subtract
.NumberValue = 77R
.ResultType = eResultType.Apply
.Run(Nothing, Nothing, Nothing)
End With
With Process.ProcessCommands.Operations(x10_segmentation)
.Operation = eOperation.Div
.NumberValue = 1.78R
.ResultType = eResultType.Apply
.Run(Nothing, Nothing, Nothing)
End With
With Process.Filter.LargeCommands.LowPassLarge(x10_segmentation)
.Text = "Low-Pass"
.Passes = 1
.Width = 50000
.Height = 1
.Run(image1, image1)
End With
'Connect with the active document
With Application.DocumentCommands.Active(Nothing)
.Run(doc1)
End Wit
Thanks in advance
Alban
0
Best Answer
-
If I understand correctly, you want your final result image to replace the initial source image. You could accomplish this by closing the source image and then doing a final Save As operation overwriting the source image. If you then close that final image along with all intermediate images, there will be no net increase in the number of images.
Of course, you need to be pretty sure that you will never need the original source image again, since it will be permanently overwritten.
0
Answers
The Apply button of the Filter panel has "New Image" checkbox. When this checkbox is active the filter is applied to a duplicated image. You, probably, had this checkbox on when you recorded the macro, it added Duplicate commands to it. If you want to apply filters to the original image, just switch the "New Image" checkbox off and record a new macro.
Yuri
Yuri