Quantcast
Channel: magick Discussions Rss Feed
Viewing all 3693 articles
Browse latest View live

New Post: Does Magick.Net support "caption:" functionality?

$
0
0
Caption internally uses FontTypeMetrics to calculate the size so it is quite strange that this is causing such a huge performance problem. Can you provide me with a small example?

New Post: Extract Image Countour

$
0
0
Hello,

I would like to ask you guys if I can use Magick.NET library to extract the clipping path of an image that was built using CorelDraw.

In my scenario the image can be exported to any file format CorelDraw supports. For me, the important this is to have a path of the external boundaries of the image, with lines and curves forming the contour path‎ of the image.

Then I would use this path inside my .NET application.

What would be the best file format for this?

Thank you,

Igor.

New Post: Extract Image Countour

$
0
0
I don't know if it is the best format but you could try using tiff images for this. With the ClipMask property you should be able to extract a mask based on your clipping path.

New Post: Any known issues with AMD processors? SEHException

$
0
0
We are using Magick.NET.dll version 6.8.5.4 in a .net 4.0 winforms app to do some image conversion. For the most part this is working fine. Occasionally we get a user with this error:

System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.
at Magick.Image.{ctor}(Image* )
at ImageMagick.MagickImage..ctor()

This happens on the call to MagickImage image = new MagickImage();

The app is compiled in x86 and we are using the x86 dll version. Whenever I test this locally or on any test machine it works fine. It works fine for the vast majority of our users. The only common link I see with users that have this problem is they are using an AuthenticAMD processor in their system info. All users are also running windows xp SP3.

Thanks for any help!

New Post: Extract Image Countour

$
0
0
Thank you for the reply,

Well, I created a sample code to load a sample .tif image, and I got a MagickBlobErrorException, with the following additional information:

unable to open image `C:\<mypath>\circle.tif': Invalid argument @ error/blob.c/OpenBlob/2643

I did not invoke the MagickNET.Initialize method, since I don´t have any custom configuration. Is this OK?

Here is the code:

using (MagickImage image = new MagickImage(@"C:\\Documentos\circle.tif"))
        {

        }
Any thoughts?

Igor.

New Post: Extract Image Countour

$
0
0
Are you sure you are using the correct path to your image? And can you add a link to your file?

New Post: Any known issues with AMD processors? SEHException

$
0
0
I am not aware of an issue with AMD processors. Can you upgrade your version of Magick.NET to the latest version and see if the problem still occurs? There have been a lot of fixes and improvements since your version. You only have one dll and you no longer need the separate ImageMagick dlls.

New Post: Extract Image Countour

$
0
0
Hello dlemstra,

If I use a wrong file path, than I get an ArgumentException with the "Unable to find file" details.

You can find the sample file here: http://sdrv.ms/1fzmr9U

I forgot to mention that I installed your libray using the Package Manager Console.

Library version: Magick.NET-Q16-x86 6.8.8.201

Thanks,

Igor.

New Post: Extract Image Countour

$
0
0
I can open the file without any problems, does your path include any special characters? ImageMagick cannot find a clipping path in your image. Are you sure you posted the correct image?

New Post: Extract Image Countour

$
0
0
One problem is solved. The file was in my local drive, but it was under skydrive folder (I think your library did not like it very much). So I moved it to another folder and image could be read successfully.

Regarding the clipping path, this is related to my original question. Should I include a clipping path in my original CorelDraw file? I did not do anything.

If I have to manually include a clipping path in every original file prior to exporting to TIFF, is there any other way to get the shape outline as a path (lines and curves) without adding a clipping path?

Thank you,

Igor.

New Post: Any known issues with AMD processors? SEHException

$
0
0
Thank you for the quick response! I will update to the latest version and try to deploy on a problem machine as soon as I can. I will report back here after that happens.

New Post: Extract Image Countour

$
0
0
The skydrive folder problem might be a bug in ImageMagick, I will look into this.

You will have to add the clipping path yourself. ImageMagick has no support for detecting a clipping path. It used to come with a library that tries to do this but that was removed due to GPL license issues. Maybe CorelDraw has some tools to generate the path?

New Post: Does Magick.Net support "caption:" functionality?

$
0
0
I have done some more debugging and found that raising the FontPointSize with 0.1 was causing the performance hit. I've changed it to 1 and now Draw is actually faster.

I did see another thing with caption though. It does not honor line breaks so that an entire line can only fit on on a single line in the image (which is what i want).

Anyway my code sample:
string fontFamily = "Droid-Serif-Bold-Italic";
string content = "Hello World!\nsecond line\nThird g";
            
var bgColor   = new MagickColor("#F0F0F0");
var fillColor = new MagickColor("#000000");
using (MagickImage image = new MagickImage(bgColor, 500, 500))
{
    var gravity       = new DrawableGravity(Gravity.Northeast);
    var textAntialias = new DrawableTextAntialias(true);
    var text          = new DrawableText(0, 0, content);

    image.Font      = fontFamily;
    image.FillColor = fillColor;

    CalculateFontPointSize(image, content);

    image.Draw(
        textAntialias,
        text,
        gravity);
}

privatevoid CalculateFontPointSize(MagickImage image, string text)
{
    // FontType Metrics only works for single lines?// set font size to smallest size
    image.FontPointsize = 0;
    double calculatedHeight = 0;
    double calculatedWidth  = 0;

    // get longest linevar lines = text.Split(new [] {"\n" }, StringSplitOptions.None);
    var longestLine = lines.OrderByDescending(x => x.Length).First();

    var metrics = image.FontTypeMetrics(longestLine);

    while (calculatedWidth < image.Width && calculatedHeight < image.Height)
    {
        image.FontPointsize += 1;

        metrics = image.FontTypeMetrics(longestLine);

        calculatedHeight = metrics.TextHeight * lines.Length;
        calculatedWidth  = metrics.TextWidth;
    }
}
VS
using (MagickImage image = new MagickImage(bgColor, 500, 500))
{
    image.Font      = fontFamily;
    image.FillColor = fillColor;

    var textImage = CreateText(fontFamily, 500, 500, content);
    image.Composite(textImage, 0, 0, CompositeOperator.Over);

}

private MagickImage CreateText(string fontFamily, int width, int height, string text)
{
    var image = new MagickImage(MagickColor.Transparent, width, height);
    
    image.FillColor = new MagickColor("#000000");
    image.Font = fontFamily;

    image.Read(string.Format("caption:{0}", text));

    return image;
}

New Post: Does Magick.Net support "caption:" functionality?

$
0
0
There is a multi line FontTypeMetrics method available in ImageMagick and that is actual being used by the caption coder. I did not notice that before. I will make this available in the next release.

New Post: Does Magick.Net support "caption:" functionality?

$
0
0
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.

New Post: Loading eps file with tiff preview only loads preview

$
0
0
Opening an eps file with an embedded tiff preview appears to be opening the preview tiff image and not the actual file.

ImageMagick.MagickImage img = new ImageMagick.MagickImage("test.eps");
returns an MagickImage object with these properties: Ept 212x233 8-bit CMYK 193.05kB

identify.exe "C:\test.eps" -verbose returns
Format: EPT (Encapsulated PostScript with TIFF preview)
Class: DirectClass
Geometry: 895x984+0+0
Base geometry: 898x988
Resolution: 304x304
Print size: 2.94408x3.23684
Units: Undefined
Type: ColorSeparation
Endianess: Undefined
Colorspace: CMYK
Depth: 8-bit

Doing a convert.exe "C:\test.eps" -alpha transparent -clip -alpha opaque "C:\foo.png" returns the full size result. Doing the same via C# returns the small version.

Is there any way to get the full file instead of the preview?

New Post: Loading eps file with tiff preview only loads preview

$
0
0
Can you add a link to your image? Feel free to contact me through CodePlex if you don't want to publicly share your image.

New Post: Loading eps file with tiff preview only loads preview

$
0
0
I sent you a link to the file.

I upgraded my version of ImageMagick from 6.5.3 to 6.8.8 and now convert.exe does the same thing.

The verbose output is:

EPT 898x988=>212x233 212x233+0+0 8-bit sRGB 120KB 0.172u 0:00.076

So it knows the full size of the image, but then it shrinks it.

New Post: Magick.NET performance

$
0
0
Hi,

I'm evaluating Magick.NET to see if we can replace our current image manipulation tool, and I've noticed that Magick.NET seems to have poorer performance than our current tool. In one situation we are loading a TIFF, resizing it, and converting it to PNG. Is there anything we can do in terms of configuration (or code changes) to improve the performance of Magick.NET?

I have tried both the 32bit version and the 64bit version.
        MagickReadSettings settings = new MagickReadSettings
        {
            FrameIndex = 0
        };
        string filePath = "C:\\TwoPageTIFF.tif";
        MagickImage image = new MagickImage(filePath, settings);
        MagickGeometry geometry = new MagickGeometry(1000, 1332);
        image.Resize(geometry);

        image.Format = MagickFormat.Png;
        byte[] result = image.ToByteArray();
Thank you!

New Post: Create Animated Gif with images of different dimensions

$
0
0
I'm building an animated gif using images of different dimensions. Example of code I'm using for each image added to the collection is below
img = New MagickImage(stream)
Dim geom As MagickGeometry = New MagickGeometry(500, 500)
geom.FillArea = True
img.Resize(geom)
With New MagickGeometry(500,500) I was hoping it would resize the image to a max width or height of 500 but it seems to ignore the width value and only uses the height value? Can you tell me what I'm doing wrong.

Thanks for your help
Viewing all 3693 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>