Code Monkey home page Code Monkey logo

netimagelibrary's People

Contributors

fschultz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

netimagelibrary's Issues

I get a warning about a incompatibility with .NET 5.08

Hello Frederik,

I am curently trying to upgrade my CineFilm digitization tools from Home to WPF.
I got the following warnings when I do the debugg compilation using .NET 5.08
I think you might be interrested in this.

Kaliko Warning

Create a jpeg image from transparent png gives black background

When i try to create a jpg from a png stream, tha background of the jpg image is black.
I try this:

        using (var Temp = System.Drawing.Image.FromStream(str))
        {
            using (var Image = new KalikoImage(Temp))
            {
                Image.BackgroundColor = Color.White;

                using (var DoneStr = new MemoryStream())
                {
                    Image.SaveJpg(DoneStr, 90);
                    DoneStr.Position = 0;

                   // Save stream
                }
            }
        }

What is wrong?

I get a "Common Error in GDI+" when saving an image with Kaliko SaveJPG.

Hello Fredrik,
you can probably remember me, the person which coded the CineStripScanner probably one of the very first users of the the Kaliko Image Library FastFilters to apply Unsharpmask to scanned Cine Film Strips.

I am now doing a new program (CineFrameGrabber) a program that should grab frames of a Cine Film (Super 8 or Normal 8) using a Digital Microscope and a stepper motor to advance the frames.
This creates some problems in synchronizing the various devices (the videocapture Device, the Serial Port
with the stepper motor and my program ). Therefore I have to use the TPL because I have to wait for the completion events of these devices.

But I do have a problem when saving images with Kaliko (under Windows 10 Home Edition 64 Bit Creators Edition). I am using VS Community 2017 .NET 4.5 and C# .

This is the code snippet I created

.....
using Kaliko.ImageLibrary;
using Kaliko.ImageLibrary.FastFilters;
using Kaliko.ImageLibrary.Filters;
using System.Drawing.Imaging;
....

....
if (snapshotSelected)
{
captureFrame.Snapshot();
}
else
{
requestImage = true;
}
taskG = new Task(new Action(showAndSaveImage));
taskG.Start();
taskG.Wait();
.......
......

    public static void showAndSaveImage()
    {
        KalikoImage theGrabbed;   // the grabbed cine film image
        int    imageNrI = ExecutionForm.actImgNo;
        String targetFile;
        string imageNrS;
        string fillZeros = "000000";
        int nrLen = 0;
        string imgType = DefinitionForm.activeInstance._imageType;  // JPG or PNG

/line 250/ Console.WriteLine("0250 showAndSaveImage started");
try
{
if (ExecutionForm.snapshotSelected == true)
{
ExecutionForm.picBoxImage = (Image)new Bitmap(ExecutionForm.aSnapshotFrame, ExecutionForm.picBoxSize);
theGrabbed = new KalikoImage(ExecutionForm.aSnapshotFrame);
}
else
{
ExecutionForm.picBoxImage = (Image)new Bitmap(ExecutionForm.aVideoFrame, ExecutionForm.picBoxSize);
theGrabbed = new KalikoImage(ExecutionForm.aVideoFrame); ;
}
if (theGrabbed != null)
{
if (DefinitionForm.activeInstance._sharpenOn == true)
{
Kaliko.ImageLibrary.FastFilters.FastUnsharpMaskFilter unsharpMaskFilter =
new Kaliko.ImageLibrary.FastFilters.FastUnsharpMaskFilter(DefinitionForm.activeInstance._radiusF,
DefinitionForm.activeInstance._contrastF,
DefinitionForm.activeInstance._thresholdI);
theGrabbed.ApplyFilter(unsharpMaskFilter);
}

                imageNrS = fillZeros + Convert.ToString(imageNrI).Trim();
                nrLen = imageNrS.Length;
                imageNrS = imageNrS.Substring((nrLen - 6), 6);
                ExecutionForm.actImgNoS = DefinitionForm.activeInstance._actProjectId +  DefinitionForm.activeInstance._subDirName + imageNrS + "." + DefinitionForm.activeInstance._imageType;
                targetFile = DefinitionForm.activeInstance._actTargetSubFolder + actImgNoS;
                switch (imgType)
                {
                    case "JPG":

/line 309/ theGrabbed.SaveJpg(targetFile, 90); // Common GDI+ error
break;
case "PNG":
theGrabbed.SavePng(targetFile);
break;
default:
theGrabbed.SavePng(targetFile);
break;
}
ExecutionForm.theRetVal = true;
}
else
{
ExecutionForm.theRetVal = false;
}
}
catch (Exception ex)
{
ExecutionForm.theRetVal = false;
Console.WriteLine("315 ex = " + ex);
}
}


And that is what I get. ( Always returnValue = false; !!! due to the Exception occured) .
What am I doing wrong. What is a common GDI+ error. I do nothing special except using
the Task Parallel Library (TPL) of MS .NET 4.5

This is the output of System.WriteLine:
ExecutionForm.txt

0250 showAndSaveImage started
"CineFrameGrabber.exe" (CLR v4.0.30319: CineFrameGrabber.exe): "C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Drawing.resources\v4.0_4.0.0.0_de_b03f5f7f11d50a3a\System.Drawing.resources.dll" geladen. Das Modul wurde ohne Symbole erstellt.
Ausnahme ausgelöst: "System.Runtime.InteropServices.ExternalException" in System.Drawing.dll
315 ex = System.Runtime.InteropServices.ExternalException (0x80004005): Allgemeiner Fehler in GDI+.
bei System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)
bei Kaliko.ImageLibrary.ImageOutput.SaveFile(KalikoImage image, String fileName, Int64 quality, String imageFormat, Boolean saveResolution)
bei Kaliko.ImageLibrary.KalikoImage.SaveJpg(String fileName, Int64 quality)
bei CineFrameGrabber.ExecutionForm.showAndSaveImage() in D:\C#Prog\Projects\CineFrameGrabber\CineFrameGrabber\ExecutionForm.cs:Zeile 309.

Many Thanks for your assistance
Wolfgang Kurz
[email protected]

The full method is atached as txt File. ExecutionForm.txt (rename it to .cs if needed)

png bit depth settings

my png's bit depth is 24, but SavePng method is 32, which increase the size of the image

A Graphics object cannot be created from an image

Hi.

I have this:
private void CreatePngImage(Stream str)
{
using (var Temp = System.Drawing.Image.FromStream(str))
{
using (var Image = new KalikoImage(Temp))
{
}
}
}

But on some image i get this:
A Graphics object cannot be created from an image that has an indexed pixel format.
on
at System.Drawing.Graphics.FromImage(Image image)
at Kaliko.ImageLibrary.KalikoImage..ctor(Image image)
at MainImage.CreatePngImage(Stream str)

I have try this:

private void CreatePngImage(Stream str)
{
using (var Temp = System.Drawing.Image.FromStream(str))
{
using (var NewBitmap = new Bitmap(Temp.Width, Temp.Height))
{
using (var Gr = Graphics.FromImage(NewBitmap))
{
Gr.DrawImage(Temp, 0, 0);
}

using (var Image = new KalikoImage(NewBitmap))
{
}
}
}
}

But i se the same error.

What can i do to fix it?

Minimalistic imaging framework

Hi Fredrik,

I am a developer of DotImaging, minimalist .NET imaging platform. I have seen your library and I am open for a possible collaboration. If you are interested, or you have any comments, you can send a mail to darko.juric2 [at] gmail.com.

Regards,
Darko

P.S.
That was the easiest way to reach you (but probably not the best).

Issue WinForms

Hi,

I tried to add the Kaliko.ImageLibrary to my WinForms application.

Everything works fine, he recognizes all the code, but when I try to compile I get following error:
The type or namespace name 'Kaliko' could not be found.

Any suggestions?

With kind regards,
Gunther

BlitFill issue on high resolution images

I'm getting strange issues with the BlitFill method on high resolution images, im using the method to watermark the images on my website with a watermark image ive created. I followed the tutorial to do so, for smaller images it works fine, for others not so much. Ive attached the results below:

image "7.jpg" ( the last one ) is correct.

11
12
4
7

BlitFill -- Doesn't fill the whole way

So I'm mostly confused more than anything as to how this has been working in the past

Both the rows and the columns are using the width of the image to see how many rows and columns there should be.

I've changed rows to be Height on my local copy and its working perfectly now.

Kaliko.ImageLibrary.KalikoImage Line 629 onwards

        public void BlitFill(Image image) {
            int width = image.Width;
            int height = image.Height;
            var columns = (int)Math.Ceiling((float)Image.Width/width);
            var rows = (int)Math.Ceiling((float)Image.Width/width);

            for (int y = 0; y < rows; y++) {
                for (int x = 0; x < columns; x++) {
                    _g.DrawImageUnscaled(image, x*width, y*height);
                }
            }
        }

Unsharpmask

            MemoryStream memstream = new MemoryStream();


            bitmap2.Save(memstream, System.Drawing.Imaging.ImageFormat.Png);

            KalikoImage imgklk = new KalikoImage(memstream);


            imgklk.ApplyFilter(new UnsharpMaskFilter(150f, 100f, 200));



            imgklk.SavePng(memstream);

            Bitmap bitmap3 = new Bitmap(memstream);

This is my code for filtering my bitmap2 image.But when i use unsharp on imgklk,i feel filtering is aplied because there is noticeably time passing program to return back but im unable to see it on bitmap3,i mean there is no difference between bitmap 2 and bitmap 3.I hope you can help me:)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.