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

New Post: Caption text color and effects

$
0
0
ok - thanks.

But for some reason using the standard fonts and no effects the caption color is always black even though I set the font color to white as in the code sample above

New Post: modulate problems

$
0
0
This is a bug in Magick.NET that will be fixed in the next release. You can use the following workaround that will stop working after the next release:
using (MagickImage magickImage = new MagickImage(@"c:\thumb.bmp"))
{
  // Assumption is the mother of all ...
  magickImage.Modulate(new Percentage(9000), new Percentage(10000), new Percentage(10000)); 
  magickImage.Write(@"c:\thumb-mod.bmp");
}

New Post: modulate problems

$
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: modulate problems

$
0
0
Thanks for quick reply, as I continue poking around should I assume until this next release that any methods that use percentage types will be same or is this with just this method? I'll probably pass larger vals when testing to be sure if I run across another method (i.e. BrightnessContrast(percentage,percentage) before I post to be certain.
Thanks again for quick response, so far impressed with what I've tested. Good job.

New Post: modulate problems

$
0
0
This is just a bug in the Modulate method, uou should not pass larger values to other methods. It is of course possible that I made this mistake twice so please report it when you find another problem.

New Post: Caption text color and effects

$
0
0
I completely missed that. I was just focusing on the effect. I will look into that.

New Post: Caption text color and effects

$
0
0

Not a problem at all – really appreciate your prompt responses.

New Post: Caption text color and effects

$
0
0
I figured out why it doesn't work. I need to set a 'special' ImageMagick option to make this work with the 'caption:' reader. This will be fixed in the next release of Magick.NET. I will try to publish that this weekend.

New Post: Caption text color and effects

$
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: Caption text color and effects

New Post: Is it possible to set "-evaluate Divide 2"

$
0
0
It seems I made a tiepo when I created the EvaluateOperator enum. This will be fixed in the next release of Magick.NET. I will also rename QuantumOperator to Evaluate.

You can however use the following command for now:
using (MagickImage image = new MagickImage("bpine_test.png"))
{
  image.Alpha(AlphaOption.Set);
  image.QuantumOperator(Channels.Alpha, EvaluateOperator.Devide, 2);
  image.Write("bpine_out.png");
}

New Post: Is it possible to set "-evaluate Divide 2"

New Post: Transparency lost converting eps to png via Magick.NET when ImageMagick source works perfectly

$
0
0
I'm having trouble maintaining transparency through Magick.NET converting from an EPS to PNG. When using Magick.NET I'm getting a plain white image, when using ImageMagick console I'm getting exactly what I expect.

A) What am I doing wrong that is causing the transparency loss
B) Is there a way to only pass direct console parameters such as I pass to ImageMagick console app?
C) Is there a way to see what would be passed to the console application upon the conversion?

File in question: http://www.myargosydirect.com/static/dam/assets/000/003/93eaeccc-fcd8-4ef1-bb46-08279a5c881a.eps

ImageMagick Console Code that works:
convert -colorspace RGB -density 72 -verbose 93eaeccc-fcd8-4ef1-bb46-08279a5c881a.eps 93eaeccc-fcd8-4ef1-bb46-08279a5c881a.png
Conversion Code (GetImageFormat returns MagickFormat.Png for this file):
        private void ConvertImage(IEnumerable<ImageSize> sizes, ImageInfo sourceInfo, MagickImage image) {
            foreach (var size in sizes) {
                if (!size.MatteImage) {
                    size.CalculateSize(sourceInfo);
                }
                image.Format = this.GetImageFormat(size.Destination);
                image.ColorSpace = global::ImageMagick.ColorSpace.RGB;
                image.Density = new MagickGeometry(size.Dpi, size.Dpi);
                image.Resize(size.MaxWidth, size.MaxHeight);
                using (var stream = new MemoryStream()) {
                    image.Write(stream);
                    size.Destination.Save(stream.ToArray());
                }
            }
        }

New Post: DPI

$
0
0
I'm also having trouble with the density feature. It show the correct ResolutionX and ResolutionY when I set the image.Density, but the end image is still the same DPI as the original.

Thank You,
Andrew

New Post: DPI

$
0
0
Sorry, I posted an incorrect answer to this thread. I cannot delete this posting, so please ignore it.

New Post: Transparency lost converting eps to png via Magick.NET when ImageMagick source works perfectly

$
0
0
A)

You should set the colorspace and density before your read the file to get the correct result. You are also doing that on the command line. You can do this with the MagickReadSettings class. Below is an example.
MagickReadSettings settings = new MagickReadSettings();
settings.ColorSpace = ColorSpace.RGB;
settings.Density = new MagickGeometry(72, 72);

using (MagickImage image = new MagickImage("93eaeccc-fcd8-4ef1-bb46-08279a5c881a.eps", settings))
{
  image.Format = MagickFormat.Png;
  byte[] bytes = image.ToByteArray(); // No need to write to a stream first.using (FileStream fs = File.OpenWrite("93eaeccc-fcd8-4ef1-bb46-08279a5c881a.png"))
  {
    fs.Write(bytes, 0, bytes.Length);
  }
}
B) and C)

Magick.NET does not use the console version of ImageMagick it calls the methods that will be called by convert.exe directly. The methods that are used by convert.exe are compiled into the Magick.NET library. Most methods and properties have the same name as their command line equivalent to make it easier to change a command line command into C# code.

New Post: Transparency lost converting eps to png via Magick.NET when ImageMagick source works perfectly

$
0
0
Thanks for the byte array trick, definitely saves some operations and wasted memory!

I'm still having trouble though, I've tried modifying my code to use either of these two blocks and neither generate the correct dpi or maintain transparency for that image. I also tried the Height/Width settings in the MagickReadSettings instead of image.Resize(x,y) but the image maintained the original size. This issues seems to be specific to all ghostscript files, I'm having the same issue with transparency in .ai, .psd and eps files.

Right now I'm trying to convert that eps to a png with 72 dpi (currently 300dpi) and a max resolution of 400x400 while maintaining aspect ratio.
public void ResizeImage(IFileInfo sourceFile, IEnumerable<ImageSize> sizes) {
            if (this.IsValidFormat(sourceFile)) {
                var resizes = sizes as ImageSize[] ?? sizes.ToArray();
                if (sizes == null || !resizes.Any()) {
                    return;
                }
                sizes = resizes.Max(s => s.MaxHeight) > resizes.Max(s => s.MaxWidth) ? resizes.OrderByDescending(s => s.MaxHeight) : resizes.OrderByDescending(s => s.MaxWidth);
                foreach (var size in sizes) {
                    if (!size.MatteImage) {
                        size.CalculateSize(this.GetImageInformation(sourceFile)[0]);
                    }
                    var settings = new MagickReadSettings {
                                                              ColorSpace = global::ImageMagick.ColorSpace.RGB,
                                                              Density = new MagickGeometry(size.Dpi, size.Dpi)
                                                          };
                    using (var image = new MagickImage(sourceFile.Get())) {
                        image.Format = this.GetImageFormat(size.Destination);
                        image.Resize(size.MaxWidth, size.MaxHeight);
                        size.Destination.Save(image.ToByteArray());
                    }
                }
            }
        }
and
public void ResizeImage(IFileInfo sourceFile, IEnumerable<ImageSize> sizes) {
            if (this.IsValidFormat(sourceFile)) {
                var resizes = sizes as ImageSize[] ?? sizes.ToArray();
                if (sizes == null || !resizes.Any()) {
                    return;
                }
                sizes = resizes.Max(s => s.MaxHeight) > resizes.Max(s => s.MaxWidth) ? resizes.OrderByDescending(s => s.MaxHeight) : resizes.OrderByDescending(s => s.MaxWidth);
                foreach (var size in sizes) {
                    if (!size.MatteImage) {
                        size.CalculateSize(this.GetImageInformation(sourceFile)[0]);
                    }
                    var settings = new MagickReadSettings {
                                                              ColorSpace = global::ImageMagick.ColorSpace.RGB,
                                                              Density = new MagickGeometry(size.Dpi, size.Dpi)
                                                          };
                    using (var image = new MagickImage(sourceFile.Get(), settings)) {
                        image.Format = this.GetImageFormat(size.Destination);
                        image.Resize(size.MaxWidth, size.MaxHeight);
                        size.Destination.Save(image.ToByteArray());
                    }
                }
            }
        }

New Post: Transparency lost converting eps to png via Magick.NET when ImageMagick source works perfectly

$
0
0
I updated the example above, I forgot to add the settings to the constructor. I am getting a png with a transparent background and it even reports 72 dpi with the identify command of ImageMagick. Are you using the latest version of Magick.NET?

New Post: Transparency lost converting eps to png via Magick.NET when ImageMagick source works perfectly

$
0
0
According to nuget I'm using 6.8.8.201. Let me run a complete clean build and see if that fixes it.

I'm wondering if I need to generate the image first at the original size with the altered ColorSpace and DPI then perform the resize as a seperate operation.

I'll report back in a few minutes.

New Post: Transparency lost converting eps to png via Magick.NET when ImageMagick source works perfectly

$
0
0
Looks like that is the issue, I need to generate the file as a png without resizing first. Then resize the png to what I want.

On a side note I have been able to reproduce a bug with ai files that contain spot color gradients (that's what the graphics guy referred to them as). Here is an example if you'd like to dig into it, but basically when you pass the attached ai file to new MagickImage(ai-file) it just hangs permanently.

File in question: www.myargosydirect.com/static/dam/assets/000/003/37cf370d-6523-45ae-9839-858c592d5460.ai

Thanks for all your assistance!

Andrew
Viewing all 3693 articles
Browse latest View live


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