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

New Post: MagickImage.ClipMask usage

$
0
0
Hi, hope someone can help me. I've been trying to apply a grayscale mask to an image with no luck. I have 2 MagickImage images, one 8-bit grayscale (my mask) and one 8-bit sRGB. They're both the same size.

I'm trying to apply the mask like so:
using (MagickImage first = magickImg)
            {
                MagickImage magickMask = new MagickImage(mask.ToBitmap());
                first.ClipMask = magickMask;
                UpdateUI("pictureBox2", first.ToBitmap());
            }
Where magickImg was already defined elsewhere, UpdateUI is my method for updating a picturebox on my main form. If I write the image to the disk I get the same result, ie. as if the mask had no effect.

I also tried:
using (MagickImage first = magickImg)
            {
                MagickImage magickMask = new MagickImage(mask.ToBitmap());
                first.Composite(magickMask, Gravity.Center, CompositeOperator.CopyOpacity);
                UpdateUI("pictureBox2", first.ToBitmap());
            }
And I've fiddled about with toggling the HasAlpha property on "first", but that doesn't make a difference.

It's worth noting that in my previous release I was using a much older version of MagickNET (IM6.5.3) and CompositeOperator.CopyOpacity worked perfectly.

*Edit - sorry it's also worth mentioning that the mask is generated by emgucv hence the "mask.ToBitmap()" line.

Many thanks

New Post: MagickImage.ClipMask usage

$
0
0
Can you share a link to your input image and your mask? And maybe also an image of the expected result.

New Post: SVG render fallback to Inkscape with 64-bit Magick.NET crashes

$
0
0
Thanks for the suggestion. I gave it a go and a Forms application had no problem passing it off to Inkscape so I'm not sure where to take it from there. On the other hand, it looks like Inkscape can't use hyperlink xlinks so this might be moot anyway (we have http url's for some of the SVG image resources). If that's incorrect or anyone has a suggestion, let me know.

Thanks for all the hard work, dlemstra. I have been waiting for a .NET-wrapped Imagemagick for a long time and this works really well.

New Post: SVG render fallback to Inkscape with 64-bit Magick.NET crashes

$
0
0
Are you able to use a debugger in your website project? Maybe you will get more information when you turn on logging:
MagickNET.SetLogEvents(LogEvents.all);
image.Debug = true;

New Post: MagickImage.ClipMask usage

$
0
0
Yeah no problem, it is a green screen image. I'd rather not provide one with people in it so here is a blank image.

Mask:
Image

Original:
Image

New Post: Resize filter parameters

$
0
0
Magick.NET/Enums/FilterType.h

Lanczos2Sharo = MagickCore::Lanczos2SharpFilter,

typo?

Lanczos2Sharp = MagickCore::Lanczos2SharpFilter,

New Post: Convert PDF to a set of PJPEG files

$
0
0
Hi ,
I have a similar problem, I'm trying to create a thumbnail from the first page of a pdf.
I copy and run the example by dlemstra and it's ok , but with this pdf i get a black backgound
What can i do?

New Post: MagickImage.ClipMask usage

$
0
0
I got round the problem by using the MagickImage.Transparent method on the mask before blurring it, just with black as the color argument, then blurred the mask to smooth the edge.
magickMask.Transparent(new MagickColor(0,0,0));
if (blur != 0) magickMask.Blur(-blur, Math.Sqrt(blur), Channels.All);
first.Composite(magickMask, Gravity.Center, CompositeOperator.CopyOpacity);
Still seems like this solution is one step longer than it need be, though.

New Post: MagickImage.compare

$
0
0
Hi!, looking for some help with the compare feature. It seems straight forward but no matter what two images I compare the MagicErrorInfo properties are always 0.

This is the code in simple form where I'm attempting to compare to different images.
    Private Sub Testing()
        Dim BaseImage As MagickImage = New MagickImage("C:\temp\BaseImage.jpg")
        Dim CompareImage As MagickImage = New MagickImage("C:\temp\CompareImage.jpg")
        Dim CompareInfo As MagickErrorInfo = BaseImage.Compare(CompareImage)

        If CompareInfo.MeanErrorPerPixel > 0 Then
            ' Do Something
        End If
    End Sub
I'm I missing something or simply doing this incorrectly?

New Post: MagickImage.compare

$
0
0
I found the issue, the two images were not the same size. After using .resize its working!

New Post: MagickImage.compare

$
0
0
You should have received an exception but Magick++ is hiding it by accident. I have committed a fix for ImageMagick and this will be fixed in the next release of Magick.NET. Thank you for finding this bug in ImageMagick.

New Post: Resize filter parameters

$
0
0
Thank you for finding this. It will be fixed in the next release of Magick.NET.

New Post: MagickImage.ClipMask usage

$
0
0
I noticed that your mask is a grayscale image. So when you copy the alpha channel you probably copy noting. I tried using the alpha method to enable the alpha channel:
magickMask.Alpha(AlphaOption.Background);
Would you mind posting your expected result, so I can compare it with my image?

New Post: Convert PDF to a set of PJPEG files

$
0
0
With the following code I am getting a white background.
MagickReadSettings settings = new MagickReadSettings();
settings.Density = new MagickGeometry(300, 300);
settings.FrameIndex = 1;

using (MagickImage image = new MagickImage())
{
    image.Read("Touchline_267700.pdf", settings);
    image.Write("Touchline_267700.FirstPage.jpg");
}

New Post: Convert PDF to a set of PJPEG files

$
0
0

I'm sorry you are right I try to add the border without compose so i achieve a the black background.
thanks
emanuele.


New Post: How to read and write Jpeg Metadata (IPTC and XMP) using Magick.NET?

$
0
0
Hi,

I am in need to read and write metadata (IPTC or XMP) from Jpeg images for my project. I am able to include Magick.NET into my C# project and able to retrieve Exif info using ExifProfile function. But I don't know which function to use to read/write IPTC/XMP info.

Any help will be much appreciated.

Thanks.

New Post: How to read and write Jpeg Metadata (IPTC and XMP) using Magick.NET?

$
0
0
With the GetProfile method you can retrieve the IPTC/XMP profile, and with the AddProfile method you can add a new profile.
using(MagickImage image = new MagickImage("input.jpg"))
{
  ImageProfile profile = image.GetProfile("IPTC");
  profile = ModifyProfile(profile);
  profile.AddProfile(profile);
}
Add this moment there are no classes for the XMP / IPTC profile but it might be a good idea to create them. You have to modify the byte array yourself. I will also see if I can change the ExifProfile class to enable modification of a values.

You do have to realize that you will loose some of the quality when you read and write a jpeg image.

New Post: How to read and write Jpeg Metadata (IPTC and XMP) using Magick.NET?

$
0
0
Thanks for the info.

Just to be clear, there are no properties or methods under ImageProfile object to retrieve IPTC info? Is there any information available on how to parse the ByteArray to retrieve individual IPTC field info?

Sorry for my ignorance and I am new to Magick.Net

New Post: How to read and write Jpeg Metadata (IPTC and XMP) using Magick.NET?

$
0
0
The only method to retrieve the IPTC info is the method ToByteArray. Once I figure out how to read the IPTC fields I will create an IptcProfile class.

New Post: Convert SVG to PNG (or any other format) does not apply preserveAspectRatio

$
0
0
Hi

I'm using Magick.NET-Q16-x64 v 6.8.6.801 from NuGet.
.Net 4.5 (VS2012).

I need to convert a SVG image to one of the raster formats (for example PNG).
I've checked the documentation and tried the code which perform convertation and all works fine (at least at first sight). Except one thing - preserveAspectRatio. I use next value preserveAspectRatio="xMinYMin slice"; but the resulting image looks like the value is preserveAspectRatio="xMinYMin meet" or like there is no preserveAspectRatio at all.

One more detail is that svg file contain linked raster image which is wrapped with svg element with preserveAspectRatio attribute so this attribute has affect.

Does Magic.NET support preserveAspectRatio attribute?
And if yes how I can make it work?

Below is svg sample code which I tested. Open it in browser and then compare to the converted with Magic.NET PNG.
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<svg width="460px" height="425px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
 <g>
  <title>Layer 1</title>
  <svg viewBox="0 0 220 300" x="0" y="0" width="460" height="425" preserveAspectRatio="xMinYMin slice">
   <image id="svg_1" height="425px" width="460px" xlink:href="http://viewallpaper.com/wp-content/uploads/2013/07/Images-Water-Wallpaper.jpg" y="0" x="0" preserveAspectRatio="xMinYMin slice"/>
  </svg>
 </g>
</svg>
Looking forward for the response/advice and thanks in advance.
Viewing all 3693 articles
Browse latest View live


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