↧
New Post: CR2 to TIFF Conversion without Color Change
↧
New Post: CR2 to TIFF Conversion without Color Change
I cannot figure out how to get the same colors as the image from photoshop. Maybe you could ask your question on the ImageMagick forum: http://www.imagemagick.org/discourse-server/index.php. And once we figure out the correct commands on the command line I can help you translate them to Magick.NET
↧
↧
New Post: Aspect Ratio
When converting an image from one type to another, is aspect ratio maintained by default? or must I tell it to?
↧
New Post: Lead Tools conversion
I'm in the process of investigating switching from the LeadTool's imaging conversion stuff to Magick.Net. LeadTools allows me to read the profile from one image and write it to another, i.e.
var iccProf = new IccProfileExtended();
iccProf.ReadFromImage(sourceFilePath, 0);
iccProf.WriteToImage(destinationStream, 0);
Does Magick.net have something similar?↧
New Post: Aspect Ratio
The default is to maintain the aspect ratio. You can find some good info about the different options here: http://www.imagemagick.org/Usage/resize/#resize. It explains the properties of the MagickGeometry class.
↧
↧
New Post: Lead Tools conversion
Magick.NET does offer something similar. I am not sure how the technique from above works but Magick.NET has to read the whole image for this to work. There is an option in Magick.NET that will skip the image data of the source image but that is not publicly available yet. I will make this available the next release. You still need to read the whole destination image. An example of how you should copy the profile is this:
using (MagickImage source = new MagickImage()) { source.Ping("source.tif"); // Not yet available use Read for now. ColorProfile profile = source.GetColorProfile(); using (MagickImage destination = new MagickImage("destintion.tif")) { destination.AddProfile(profile); destination.Write("destination.tif"); } }
↧
New Post: problems using group4 compression
Hi,
In command line I found two ways to convert jpg to pdf with group4 compression:
First ( with two commands ):
$ convert desktop.jpg desktop.pbm
$ convert -monochrome -compress group4 desktop.pbm desktop-mono-grp4-2.pdf
Second ( with one single command and best compression ):
$ convert -thereshold 80% -compress group4 desktop.jpg desktop-mono-grp4-2.pdf
With first the source I try is
using (MagickImage image = new MagickImage(@"C:\Users\DXD\Desktop\compresion\test.jpg"))
using (MagickImage image = new MagickImage(@"C:\Users\DXD\Desktop\compresion\test.jpg"))
System.AccessViolationException
{"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."}
at Magick.Image.write(Image* , basic_string<char\,std::char_traits<char>\,std::allocator<char> > )
at ImageMagick.MagickWriter.Write(Image image, String fileName)
at ImageMagick.MagickImage.Write(String fileName)
What I'm doing wrong ?
In command line I found two ways to convert jpg to pdf with group4 compression:
First ( with two commands ):
$ convert desktop.jpg desktop.pbm
$ convert -monochrome -compress group4 desktop.pbm desktop-mono-grp4-2.pdf
Second ( with one single command and best compression ):
$ convert -thereshold 80% -compress group4 desktop.jpg desktop-mono-grp4-2.pdf
With first the source I try is
using (MagickImage image = new MagickImage(@"C:\Users\DXD\Desktop\compresion\test.jpg"))
{
image.Format = ImageMagick.MagickFormat.Pbm;
image.Write(@"C:\Users\DXD\Desktop\compresion\test4.pbm");
}
using (MagickImage image = new MagickImage(@"C:\Users\DXD\Desktop\compresion\test4.pbm"))
{
image.IsMonochrome = true;
image.CompressionMethod = CompressionMethod.Group4;
image.Write(@"C:\Users\DXD\Desktop\compresion\testpdf4.pdf");
}
and with secondusing (MagickImage image = new MagickImage(@"C:\Users\DXD\Desktop\compresion\test.jpg"))
{
image.Threshold(80);
image.CompressionMethod = CompressionMethod.Group4;
image.Write(@"C:\Users\DXD\Desktop\compresion\test10.pdf");
}
In both cases I get this error:System.AccessViolationException
{"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."}
at Magick.Image.write(Image* , basic_string<char\,std::char_traits<char>\,std::allocator<char> > )
at ImageMagick.MagickWriter.Write(Image image, String fileName)
at ImageMagick.MagickImage.Write(String fileName)
What I'm doing wrong ?
↧
New Post: problems using group4 compression
You are not doing anything wrong. You are actually doing something right :). You just found a bug in ImageMagick. I will look into it directly!
↧
New Post: Use fuzz on image (Usar fuzz en imagen)
Hello I would like to know how I can perform this command console magick.net.
Example:
convert gradientBlue.png -fuzz 50% -fill '#ff0000' -opaque '#0000ff' output.png
Source: http://www.rpublica.net/imagemagick/basicas.html#fuzz
I hope your help
Hola me gustaria saber como puedo realizar este comando de consola con magick.net.
Ejemplo:
convert gradientBlue.png -fuzz 50% -fill '#ff0000' -opaque '#0000ff' output.png
Fuente: http://www.rpublica.net/imagemagick/basicas.html#fuzz
Espero su ayuda
Example:
convert gradientBlue.png -fuzz 50% -fill '#ff0000' -opaque '#0000ff' output.png
Source: http://www.rpublica.net/imagemagick/basicas.html#fuzz
I hope your help
Hola me gustaria saber como puedo realizar este comando de consola con magick.net.
Ejemplo:
convert gradientBlue.png -fuzz 50% -fill '#ff0000' -opaque '#0000ff' output.png
Fuente: http://www.rpublica.net/imagemagick/basicas.html#fuzz
Espero su ayuda
↧
↧
New Post: Use fuzz on image (Usar fuzz en imagen)
You should do the following with the latest version of Magick.NET:
Yo no hablo español, así que no puedo añadir una traducción española :)
using (MagickImage gradient = new MagickImage("gradientBlue.png")) { gradient.ColorFuzz = 50; gradient.Opaque(new MagickColor("#0000ff"), new MagickColor("#ff0000")); gradient.Write("output.png"); }
↧
New Post: problems using group4 compression
Thanks dlemstra.
If I can help you in our side tell me, I can provide you the file I'm using for testing and the expected results on each conversion process.
If I can help you in our side tell me, I can provide you the file I'm using for testing and the expected results on each conversion process.
↧
New Post: problems using group4 compression
The new release has been published this weekend. Can you download Magick.NET 6.8.8.901 and test if this has resolved your problem?
↧
New Post: Layers with distort perspective
Hi,
I'm trying to place one image over anther image with a perceptive to the second image. I've tried 100 different things, but I'm facing 2 problems.
First problem is that the canvas of the overlay image gets crops, and the second problem is the perspective.
So here are my images:
Background:
Overlay:
This is what I want to do (made in photoshop):
Here are some code I tried:
Ps, I'm fairly new to ImageMagick, and I all ready read Layering and Distorting on imagemagick.org
Thank you!
I'm trying to place one image over anther image with a perceptive to the second image. I've tried 100 different things, but I'm facing 2 problems.
First problem is that the canvas of the overlay image gets crops, and the second problem is the perspective.
So here are my images:
Background:
Overlay:
This is what I want to do (made in photoshop):
Here are some code I tried:
using (var images = new MagickImageCollection())
{
var first = new MagickImage(context.Server.MapPath("~/files/house.jpg"));
var second = new MagickImage(context.Server.MapPath("~/files/monkey.jpg"));
double[] args =
{
186,93, 185,270, 298,220, 293,133,
};
second.Distort(DistortMethod.Perspective, args);
images.Add(first);
images.Add(second);
using (var result = images.Merge())
{
result.Write(context.Server.MapPath("~/files/house_with_paint.jpg"));
}
}
Can someone guide in what to do? Ps, I'm fairly new to ImageMagick, and I all ready read Layering and Distorting on imagemagick.org
Thank you!
↧
↧
New Post: Possible issue writing to stream
Using the following file as my source(.eps):
https://www.dropbox.com/s/b4pn07h4w4mnp65/PreviewforEPS.eps
This conversion works fine going from .eps to .jpg:
https://www.dropbox.com/s/b4pn07h4w4mnp65/PreviewforEPS.eps
This conversion works fine going from .eps to .jpg:
using (MagickImage image2 = new MagickImage("fileSource.eps"))
{
image2.Strip();
image2.Write("fileDestination.jpg");
}
The following does NOT. It works for some other conversions, but not .eps to .jpg using (MagickImage image2 = new MagickImage("fileSource.eps"))
{
image2.Strip();
Stream fs = new FileStream(fileDestination.jpg", FileMode.OpenOrCreate);
image2.Write(fs);
}
Thanks.↧
New Post: Possible issue writing to stream
Your second example is writing an eps file. When you write to a stream the Format of the input stream is used. If you want to write to a different format you will have to set the Format property of your MagickImage.
using (MagickImage image2 = new MagickImage("fileSource.eps")) { image2.Strip(); // This uses the format of the input image.using (Stream fs = new FileStream("thisIsActualyAn.eps", FileMode.OpenOrCreate)) { image2.Write(fs); } image2.Format = MagickFormat.Jpeg; using (Stream fs = new FileStream("fileDestination.jpg", FileMode.OpenOrCreate)) { image2.Write(fs); } }
↧
New Post: Layers with distort perspective
I got really close with the code below. You only have to fine-tune the distortion values and the position.
I used the following example: http://www.imagemagick.org/Usage/distorts/#affine_examples
I used the following example: http://www.imagemagick.org/Usage/distorts/#affine_examples
// Magick.NET understands the ~ prefix.var first = new MagickImage(@"~\files\house.jpg"); var second = new MagickImage(@"~\files\monkey.jpg"); double[] args = { // I just entered a bunch of numbers till I got close to what you want. 0,0, 0,0, 0,120, 0,98, 200,0, 65,-50 }; second.HasAlpha = true; // -alpha set second.VirtualPixelMethod = VirtualPixelMethod.Transparent; // -virtual-pixel transparent second.Distort(DistortMethod.Affine, args); // Crop part of the image so it won't overflow 'first'int x = 105; second.Crop(first.Width - x, second.Height, Gravity.West); // Position the second image second.Page = new MagickGeometry(x, 55, 0, 0); using (var images = new MagickImageCollection()) { images.Add(first); images.Add(second); using (var result = images.Merge()) { result.Write(@"(@"~\files\house_with_paint.jpg"); } }
↧
New Post: Layers with distort perspective
wow! This is really nice!
These numbers: 186,93, 185,270, 298,220, 293,133, are actually x-y for each point of the image.
Do you know if its possible to set only x-y for each corner of the image, instead of first do the perspective, and then set position with Page?
And thank you so much for this script! It helped a lot. Gonna buy something of that wishlist.
These numbers: 186,93, 185,270, 298,220, 293,133, are actually x-y for each point of the image.
Do you know if its possible to set only x-y for each corner of the image, instead of first do the perspective, and then set position with Page?
And thank you so much for this script! It helped a lot. Gonna buy something of that wishlist.
↧
↧
New Post: Layers with distort perspective
I am not sure if that is possible but that would make it much easier for you. I will have to look into this when I get home from work.
↧
New Post: Layers with distort perspective
Thank you so much!
It could be really really nice if you could help out with this.
It could be really really nice if you could help out with this.
↧
New Post: Padding out Thumbnails
Original Image: 600px wide by 1000px tall (PNG format)
Let's say I want to resize the above image down to 108px by 108px. Obviously looking at my original image, the image would be distorted if I had it fill this 'thumbnail' version.
If I use the MagickImage.Resize(100, 100) command, this works great but the end image size is roughly 108 x 65. What I truly want is for the remaining space to be transparent, centering the original image into the resized 100 x 100 image.
Looking at the Magick documentation, it appears the "Pad Out the Thumbnail" section would fit the bill: http://www.imagemagick.org/Usage/thumbnails/#fit_summery
I just can't figure out how it should be written in C# .NET
Let's say I want to resize the above image down to 108px by 108px. Obviously looking at my original image, the image would be distorted if I had it fill this 'thumbnail' version.
If I use the MagickImage.Resize(100, 100) command, this works great but the end image size is roughly 108 x 65. What I truly want is for the remaining space to be transparent, centering the original image into the resized 100 x 100 image.
Looking at the Magick documentation, it appears the "Pad Out the Thumbnail" section would fit the bill: http://www.imagemagick.org/Usage/thumbnails/#fit_summery
I just can't figure out how it should be written in C# .NET
↧