Aurigma Forums
»
Graphics Mill
»
Discussions – Graphics Mill
»
Minimum and Maximum Morphological Filters not working for BMP images
Rank: Newbie
Groups: Guest
Joined: 8/20/2019(UTC) Posts: 4
|
I am following this link to apply minimum and maximum transformation filter https://www.graphicsmill...ximum-median-filters.htm But I am getting 'Aurigma.GraphicsMill.UnsupportedPixelFormatException: 'The specified pixel format is not supported.' on the Apply() method. below is my sample code. Code:EnlargeImageByPixel(@"Images\1_92_mask.bmp", @"Output\1_92_mask_enlarged_2px.bmp", 2);
public static void EnlargeImageByPixel(string sourceFile, string targetFile, int pixel)
{
using(var bitmap = new Bitmap(sourceFile))
using(var minimum = new Minimum())
{
minimum.Radius = pixel;
using (var newBitmap = minimum.Apply(bitmap))
{
newBitmap.Save(targetFile);
}
}
}
Attaching the source BMP file. Edited by user Tuesday, August 20, 2019 4:41:29 AM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 7/28/2003(UTC) Posts: 1,660
Thanks: 5 times Was thanked: 76 time(s) in 74 post(s)
|
Hi Prosanta, It seems you have not attached the image you would like to process. |
Best regards, Fedor Skvortsov
|
|
|
|
Rank: Newbie
Groups: Guest
Joined: 8/20/2019(UTC) Posts: 4
|
Hi Fedor, The attachment link is not working. Its not uploading any image attachment in this post.
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 7/28/2003(UTC) Posts: 1,660
Thanks: 5 times Was thanked: 76 time(s) in 74 post(s)
|
Did you click the Start upload button? Sure, it is not intuitive UX.
|
Best regards, Fedor Skvortsov
|
|
|
|
Rank: Newbie
Groups: Guest
Joined: 8/20/2019(UTC) Posts: 4
|
Yes I have clicked the StartUpload button, its shows a progress bar of uploading and then it doesn't get disappear automatically as its says. but no images get uploaded..
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 7/28/2003(UTC) Posts: 1,660
Thanks: 5 times Was thanked: 76 time(s) in 74 post(s)
|
The image has the indexed pixel format which is not supported by the morphological filters. To fix the problem you need to convert images to the grayscale pixel format. Code:using (var bitmap = new Bitmap("../../1_92_mask.bmp"))
using (var minimum = new Minimum())
{
//Convert to the grayscale pixel format
bitmap.ColorManagement.Convert(PixelFormat.Format8bppGrayscale);
minimum.Radius = 1;
using (var newBitmap = minimum.Apply(bitmap))
{
//You may convert it back to the indexed pixel format
//if it is neccessary
//newBitmap.ColorManagement.Convert(PixelFormat.Format8bppIndexed);
newBitmap.Save("../../out.bmp");
}
}
|
Best regards, Fedor Skvortsov
|
|
|
|
Rank: Newbie
Groups: Guest
Joined: 8/20/2019(UTC) Posts: 4
|
Thanks a lot @Fedor. It works now.
|
|
|
|
Aurigma Forums
»
Graphics Mill
»
Discussions – Graphics Mill
»
Minimum and Maximum Morphological Filters not working for BMP images
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.