Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
Prosanta Mondal  
#1 Posted : Tuesday, August 20, 2019 4:40:46 AM(UTC)
Prosanta Mondal

Rank: Newbie

Groups: Member
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

Fedor  
#2 Posted : Tuesday, August 20, 2019 6:48:54 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
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
Prosanta Mondal  
#3 Posted : Wednesday, August 21, 2019 1:04:51 AM(UTC)
Prosanta Mondal

Rank: Newbie

Groups: Member
Joined: 8/20/2019(UTC)
Posts: 4

Hi Fedor,

The attachment link is not working. Its not uploading any image attachment in this post.
Fedor  
#4 Posted : Wednesday, August 21, 2019 4:15:19 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
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.

forum_upload.png
Best regards,
Fedor Skvortsov
Prosanta Mondal  
#5 Posted : Wednesday, August 21, 2019 4:47:06 AM(UTC)
Prosanta Mondal

Rank: Newbie

Groups: Member
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..
Fedor  
#6 Posted : Saturday, August 24, 2019 6:01:06 PM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
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
Prosanta Mondal  
#7 Posted : Monday, August 26, 2019 2:45:57 AM(UTC)
Prosanta Mondal

Rank: Newbie

Groups: Member
Joined: 8/20/2019(UTC)
Posts: 4

Thanks a lot @Fedor. It works now.
Users browsing this topic
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.