Do you need consulting from ImageMagick experts and are willing to pay for their expertise? Or are you well versed in ImageMagick and offer paid consulting? If so, post here otherwise post elsewhere for free assistance.

I am using the Windows distribution and calling the convert exe to perform a number of operations on PNG images summarised as follows:

1. Size to a pre-specified size, maintaining aspect ratio
2. When the canvas increases, set the new parts of the background to 100% transparent
3. Add a border around the image of 10% transparent
4. Input & output images (SrcImg & TgtImg) are PNG

The source images are actually exported programmatically from PowerPoint as PNG files whilst those images within a presentation may be transparent PNG files or flattened JPG files.

An issue occurs whereby an antialias border of pixels appears around the original image if the original source in PowerPoint is a non-transparent JPG. Let's say I have a source image of 50x50px, when the convert command is run, the final image ends up at the target 100x100px with a transparent background as expected but there is a square outline of pixels, 1px wide around the original 50x50px image where IM appears to be trying to blend the outer edge of the image into the new canvas size transparent background. Normally this wouldn't be an issue but the this "invisible" border is actually being rendered in its final destination as a very visible grey border. The example below shows two images, the first was created by exporting a JPG version of the image from PowerPoint and applying the above command (with different dimensions) and the one on the right created in the same way except the source image in PowerPoint was a transparent PNG (transparent outside of the blue circle).

Not sure I fully understand your problem without seeing the actual source file.

But if you are adding a transparent border to a JPG and then resizing and saving as JPG, you will get a black border, since JPG does not support transparency. It therefore turns off the transparency, leaving the black underlying border around.

Good morning experts. Thank you all for the replies. I have uploaded some test images as follows:

1. PPT-2000x2000-PNG.png = Programmatic export of the PNG version of the logo from PowerPoint to a PNG file = source 1 for ImageMagick
2. PPT-2000x2000-JPG.png = Programmatic export of the JPG version of the logo from PowerPoint to a PNG file = source 2 for ImageMagick
3. IM-2000x2000-PNG.png = Output 1 from ImageMagick of source image 1 above
4. IM-2000x2000-JPG.png = Output 2 from ImageMagick of source image 2 above - note the semi-transparent artefact I'm trying to avoid around the original border of the circle, starting at the top left corner at coord 48,10. Normally this wouldn't be an issue but for some reason, Microsoft Office is incorrectly rendering that 1px wide semi-transparent border as a grey outline when loaded into a fluent ribbon gallery control (see my original screenshot above).

I see some other questions relating to the command line structure and as I developed this a long time ago, I can't recall why all of the various elements are there!

But if you are adding a transparent border to a JPG and then resizing and saving as JPG, you will get a black border, since JPG does not support transparency. It therefore turns off the transparency, leaving the black underlying border around.

The undesired effect occurs when processing a PNG source image (exported from a JPG image within PowerPoint to a PNG image) to a target PNG image. To summarise: (4 x images added above)

PPT : JPG image on a slide is exported programmatically as a PNG to the Windows file system
IM : PNG image from above is processed which is adding a 1px wide anti-aliasing border around the original image
PPT : PNG image created by IM is imported into the Fluent ribbon UI as a gallery item and is rendered with a grey outline around the original JPG image boundary (as shown in my original image in this post).

Thanks fmw42. That certainly gets rid of the unwanted grey border from the JPG image exported from PowerPoint as a PNG. It does however degrade the PNG image exported from PowerPoint as PNG (introducing jaggies around the logo outer circle) and also has unwanted side effects on other images (that I've not included so far) where grayscale transparency exists within the image boundary. I need to sleep on this (I'm in the UK and it's late)...

Thanks again fmw42. I tried the trim idea and it didn't yield the desired result. I think it will be useful to sketch what I'm trying to achieve as follows:

I'm starting to think that what I want to do isn't possible because it implies processing different source images in different ways. For example, if the original source image from PowerPoint was a PNG, apply anti-alias but if it was a flattened JPG, don't apply anti-alias. Not sure even if "anti-alias" is something that can be enabled/disabled or if that's your channel/threshold suggestion that effectively does that. I'm also not sure if it's possible to pre-analyse the two source PNG images in the example above (PPT-2000x2000-PNG.png and PPT-2000x2000-JPG.png) in order to branch accordingly in my batch code.

Also is the 10% transparency just inside the border of your image or just outside it?

I do not understand the following. The issue is the 10% transparent border you want to put around the image before inserting it into the fully transparent background image of target size. That partial transparency is what is causing your dark line. I do not think you can add partial transparency and have your final software render that properly. It appears to be a limitation with your final software. The best you could do is put in the partial transparency and then flatten that against some background color (most likely your average border color).

Why are you converting JPG and PNG from Powerpoint to another PNG before creating the output PNG? Seems to me that you should just go from the Powerpoint image to the final image directly. Can you also provide the raw images directly from Powerpoint