Quantcast
Channel: Magick.NET
Viewing all 5763 articles
Browse latest View live

Closed Unassigned: Looking for version x64 for net 4.5 [1326]

$
0
0
Dear,

Where can I find a x64 version in order to use in net 4.5? Or how can I compile to produce those dlls?

Thanks,

New Post: CompositeOperator enum

$
0
0
It seems I made a mistake when translating your command to code. You don't need to set a Mask. The following works in my development build:
using (MagickImage img = new MagickImage("alphatemp1.png"))
{
  using (MagickImage mask = new MagickImage("alphatemp2.png"))
  {
    img.Composite(mask, 0, 0, CompositeOperator.CopyAlpha);
    img.Write("final_im7.png");
  }
}
You will get the same output as IM6 in the next release of Magick.NET

New Post: Image transparency and opacity issue.

$
0
0
This problem is not related to the other issue. The reason you are seeing the grey pixels is because you are using EvaluateOperator.Set. This will set the alpha to (Quantum.Max / 2) for every pixel, even the pixels that are already fully transparent. You will get the correct result if you use EvaluateOperator.Min. It will set the alpha to at least (Quantum.Max / 2) and that will keep the fully transparent pixels the same. Below is a simplified version of your code.
using (MagickImage img = new MagickImage(responseStream))
{
  double opacitySetting = Quantum.Max / (Quantum.Max * 0.5);
  img.Alpha(AlphaOption.Set);
  img.Evaluate(Channels.Alpha, EvaluateOperator.Min, Quantum.Max / opacitySetting);

  using (MagickImage tiles = new MagickImage("C:\\bar.png")
  {
    tiles.Composite(img, Gravity.Center, CompositeOperator.Atop);
    tiles.Write("C:\\foo.png");
  }
}

New Post: How do I translate this to Magick.net?

$
0
0
This problem has been fixed in my development build. I will try to publish a new release this week.

New Post: .Write() crashes application

$
0
0
dlemstra wrote:
You can find some more information about collecting a crash dump here: http://msdn.microsoft.com/en-us/library/d5zhxt22.aspx
Thanks for the crash dump link, however i can't make such file as it is required VS to be installed on the servers where I run the application..

The image format doesn't matter about the crashes as i tested separately with each of the four formats and the app crashes with all.

For sure there's some issue in the .Write(), as since yesterday i switched to a
Using bm As Bitmap = Img.Tobitmap
bm.save("file....")
End Using
and so far there's not and a single crash and this alternative suits me

Sorry, that I can't generate a crash file and help you out with the issue..

New Post: Losing transparency with CMYK

$
0
0
timpeters wrote:
  1. that it should? do most CMYK images contain an alpha channel? I'm more of a developer and not an true image guy so there are pieces that I miss.
I don't think it should contain an alpha channel. But I have no good answer to your other question. It's the same question as if you where asking me if most images contain an alpha channel. I don't know the answer. There are CMYK images that have an alpha channel (CMYKA) and CMYK images that don't have an alpha channel.

timpeters wrote:
  1. if it did contain an alpha channel, would this not be an issue?
Then we would have to figure out how we can extract the alpha channel with Ghostscript from a CMYK image. Our current code does not support CMYKA images, it just threats them as CMYK.

New Post: Losing transparency with CMYK

$
0
0
Ah. I think I get it now. Thanks. You've been extremely helpful. Any idea as to when your next full release will be? No rush on my part. Your current release is working very well for us right now.

New Post: Issue with composited png

$
0
0
Thanks a lot for the help dlemstra! Great library and super helpful.

New Post: Losing transparency with CMYK

$
0
0
The next release will probably be at the end of January.

New Post: Issue with Scale() method

$
0
0
On some images (i think since version either 7... 7 or 7...8), when doing a .Scale() I get corrupted result like this:

http://prntscr.com/5l32q0

Here's the original image: http://i.imgur.com/yskoPW9.jpg

This only happens with Scale(), Zoom() works just fine

To replicate the issue simply do a .Scale(New Percentage(150)) for example

New Post: Issue with Scale() method

$
0
0
This is probably another bug in the ScaleImage method of ImageMagick. I will take a look at it later tonight.

New Post: .Write() crashes application

$
0
0
dlemstra wrote:
Can you not reproduce the issue on your local machine? Getting a crash dump will help to really fix the problem. It would also help if you can provide me with a really small sample application that I can use to reproduce the problem.
Please check your email when you have time, I sent you more info about the issue and crash files as well

Updated Wiki: Convert PDF

$
0
0

Installation

You need to install the latest version of GhostScript before you can convert a pdf using Magick.NET.

Make sure you only install the version of GhostScript with the same platform. If you use the 64-bit version of Magick.NET you should also install the 64-bit version of Ghostscript. You can use the 32-bit version together with the 64-version but you will get a better performance if you keep the platforms the same.

Convert PDF to multiple images.

C#
MagickReadSettings settings = new MagickReadSettings();
// Settings the density to 300 dpi will create an image with a better quality
settings.Density = new PointD(300, 300);

using (MagickImageCollection images = new MagickImageCollection())
{
  // Add all the pages of the pdf file to the collection
  images.Read("Snakeware.pdf", settings);
  
  int page = 1;
  foreach (MagickImage image in images)
  {
    // Write page to file that contains the page number
    image.Write("Snakeware.Page" + page + ".png");
    // Writing to a specific format works the same as for a single image
    image.Format = MagickFormat.Ptif;
    image.Write("Snakeware.Page" + page + ".tif");    
    page++;
  }
}
VB.NET
Dim settings AsNew MagickReadSettings()
' Settings the density to 300 dpi will create an image with a better quality
settings.Density = New PointD(300, 300)

Using images AsNew MagickImageCollection()
  ' Add all the pages of the pdf file to the collection
  images.Read("Snakeware.pdf", settings)

  Dim page AsInteger = 1
  ForEach image As MagickImage In images
    ' Write page to file that contains the page number
    image.Write("Snakeware.Page"& page & ".png")
    ' Writing to a specific format works the same as for a single image
    image.Format = MagickFormat.Ptif
    image.Write("Snakeware.Page"& page & ".tif")
    page += 1
  NextEndUsing

Convert PDF to one image.

C#
MagickReadSettings settings = new MagickReadSettings();
// Settings the density to 300 dpi will create an image with a better quality
settings.Density = new PointD(300, 300);

using (MagickImageCollection images = new MagickImageCollection())
{
  // Add all the pages of the pdf file to the collection
  images.Read("Snakeware.pdf", settings);

  // Create new image that appends all the pages horizontallyusing (MagickImage horizontal = images.AppendHorizontally())
  {
    // Save result as a png
    horizontal.Write("Snakeware.horizontal.png");
  }
  
  // Create new image that appends all the pages horizontallyusing (MagickImage vertical = images.AppendVertically())
  {
    // Save result as a png
    vertical.Write("Snakeware.vertical.png");
  }
}
VB.NET
Dim settings AsNew MagickReadSettings()
' Settings the density to 300 dpi will create an image with a better quality
settings.Density = New PointD(300, 300)

Using images AsNew MagickImageCollection()
  ' Add all the pages of the pdf file to the collection
  images.Read("Snakeware.pdf", settings)

  ' Create new image that appends all the pages horizontallyUsing horizontal As MagickImage = images.AppendHorizontally()
    ' Save result as a png
    horizontal.Write("Snakeware.horizontal.png")
  EndUsing' Create new image that appends all the pages horizontallyUsing vertical As MagickImage = images.AppendVertically()
    ' Save result as a png
    vertical.Write("Snakeware.vertical.png")
  EndUsingEndUsing

Create a PDF from two images:

C#
using (MagickImageCollection collection = new MagickImageCollection())
{
  // Add first page
  collection.Add(new MagickImage("SnakewarePage1.jpg"));
  // Add second page
  collection.Add(new MagickImage("SnakewarePage2.jpg"));

  // Create pdf file with two pages
  collection.Write("Snakeware.pdf");
}
VB.NET
Using collection AsNew MagickImageCollection()
  ' Add first page
  collection.Add(New MagickImage("SnakewarePage1.jpg"))
  ' Add second page
  collection.Add(New MagickImage("SnakewarePage2.jpg"))

  ' Create pdf file with two pages
  collection.Write("Snakeware.pdf")
EndUsing

Create a PDF from a single image:

C#
// Read image from fileusing (MagickImage image = new MagickImage("Snakeware.jpg"))
{
  // Create pdf file with a single page
  image.Write("Snakeware.pdf");
}
VB.NET
' Read image from fileUsing image AsNew MagickImage("SnakewarePage.jpg")
  ' Create pdf file with a single page
  image.Write("Snakeware.pdf")
EndUsing

Read a single page from a PDF:

using (MagickImageCollection collection = new MagickImageCollection())
{
  MagickReadSettings settings = new MagickReadSettings();
  settings.FrameIndex = 0; // First page
  settings.FrameCount = 1; // Number of pages// Read only the first page of the pdf file
  collection.Read("Snakeware.pdf", settings);

  // Clear the collection
  collection.Clear();

  settings.FrameCount = 2; // Number of pages// Read the first two pages of the pdf file
  collection.Read("Snakeware.pdf", settings);
}
VB.NET
Using collection AsNew MagickImageCollection()
  Dim settings AsNew MagickReadSettings()
  settings.FrameIndex = 0 ' First page
  settings.FrameCount = 1 ' Number of pages' Read only the first page of the pdf file
  collection.Read("Snakeware.pdf", settings)

  ' Clear the collection
  collection.Clear()

  settings.FrameCount = 2 ' Number of pages' Read the first two pages of the pdf file
  collection.Read("Snakeware.pdf", settings)
EndUsing

Updated Wiki: Read image

$
0
0

Read image:

C#
// Read from file.using (MagickImage image = new MagickImage("Snakeware.jpg"))
{
}

// Read from stream.using (MemoryStream memStream = LoadMemoryStreamImage())
{
  using (MagickImage image = new MagickImage(memStream))
  {
  }
}

// Read from byte array.byte[] data = LoadImageBytes();
using (MagickImage image = new MagickImage(data))
{
}

// Read image that has no predefined dimensions.
MagickReadSettings settings = new MagickReadSettings();
settings.Width = 800;
settings.Height = 600;
using (MagickImage image = new MagickImage("xc:yellow", settings))
{
}

using (MagickImage image = new MagickImage())
{
  image.Read("Snakeware.jpg");
  image.Read(memStream);
  image.Read("xc:yellow", settings);

  using (MemoryStream memStream = LoadMemoryStreamImage())
  {
    image.Read(memStream);
  }
}
VB.NET
' Read from file.Using image AsNew MagickImage("Snakeware.jpg")
EndUsing' Read from stream.Using memStream As MemoryStream = LoadMemoryStreamImage()
  Using image AsNew MagickImage(memStream)
  EndUsingEndUsing' Read from byte array.Dim data AsByte() = LoadImageBytes()
Using image AsNew MagickImage(data)
EndUsing' Read image that has no predefined dimensions.Dim settings AsNew MagickReadSettings()
settings.Width = 800
settings.Height = 600
Using image AsNew MagickImage("xc:yellow", settings)
EndUsingUsing image AsNew MagickImage()
  image.Read("Snakeware.jpg")
  image.Read(memStream)
  image.Read("xc:yellow", settings)

  Using memStream As MemoryStream = LoadMemoryStreamImage()
    image.Read(memStream)
  EndUsingEndUsing

Read basic image information:

C#
// Read from file
MagickImageInfo info = new MagickImageInfo("Snakeware.jpg");

// Read from streamusing (MemoryStream memStream = LoadMemoryStreamImage())
{
  info = new MagickImageInfo(memStream);
}

// Read from byte arraybyte[] data = LoadImageBytes();
info = new MagickImageInfo(data);

info = new MagickImageInfo();
info.Read("Snakeware.jpg");
using (MemoryStream memStream = LoadMemoryStreamImage())
{
  info.Read(memStream);
}
info.Read(data);

Console.WriteLine(info.Width);
Console.WriteLine(info.Height);
Console.WriteLine(info.ColorSpace);
Console.WriteLine(info.Format);
Console.WriteLine(info.ResolutionX);
Console.WriteLine(info.ResolutionY);
VB.NET
' Read from fileDim info AsNew MagickImageInfo("Snakeware.jpg")

' Read from streamUsing memStream As MemoryStream = LoadMemoryStreamImage()
  info = New MagickImageInfo(memStream)
EndUsing' Read from byte arrayDim data AsByte() = LoadImageBytes()
info = New MagickImageInfo(data)

info = New MagickImageInfo()
info.Read("Snakeware.jpg")
Using memStream As MemoryStream = LoadMemoryStreamImage()
  info.Read(memStream)
EndUsing
info.Read(data)

Console.WriteLine(info.Width)
Console.WriteLine(info.Height)
Console.WriteLine(info.ColorSpace)
Console.WriteLine(info.Format)
Console.WriteLine(info.ResolutionX)
Console.WriteLine(info.ResolutionY)

Read image with multiple layers/frames:

C#
// Read from fileusing (MagickImageCollection collection = new MagickImageCollection("Snakeware.gif"))
{
}

// Read from streamusing (MemoryStream memStream = LoadMemoryStreamImage())
{
  using (MagickImageCollection collection = new MagickImageCollection(memStream))
  {
  }
}

// Read from byte arraybyte[] data = LoadImageBytes();
using (MagickImageCollection collection = new MagickImageCollection(data))
{
}

// Read pdf with custom density.
MagickReadSettings settings = new MagickReadSettings();
settings.Density = new PointD(144, 144);

using (MagickImageCollection collection = new MagickImageCollection("Snakeware.pdf", settings))
{
}

using (MagickImageCollection collection = new MagickImageCollection())
{
  collection.Read("Snakeware.jpg");
  using (MemoryStream memStream = LoadMemoryStreamImage())
  {
    collection.Read(memStream);
  }
  collection.Read(data);
  collection.Read("Snakeware.pdf", settings);
}
VB.NET
' Read from fileUsing collection AsNew MagickImageCollection("Snakeware.gif")
EndUsing' Read from streamUsing memStream As MemoryStream = LoadMemoryStreamImage()
  Using collection AsNew MagickImageCollection(memStream)
  EndUsingEndUsing' Read from byte arrayDim data AsByte() = LoadImageBytes()
Using collection AsNew MagickImageCollection(data)
EndUsing' Read pdf with custom density.Dim settings AsNew MagickReadSettings()
settings.Density = New PointD(144, 144)

Using collection AsNew MagickImageCollection("Snakeware.pdf", settings)
EndUsingUsing collection AsNew MagickImageCollection()
  collection.Read("Snakeware.jpg")
  Using memStream As MemoryStream = LoadMemoryStreamImage()
    collection.Read(memStream)
  EndUsing
  collection.Read(data)
  collection.Read("Snakeware.pdf", settings)
EndUsing

Source code checked in, #36906

$
0
0
Changed type of MagickReadSettings.Density from MagickGeometry to PointD.

Source code checked in, #36911

$
0
0
Added AddRange method that has an IEnumerable<MagickImage> argument to MagickImageCollection.

Source code checked in, #36912

$
0
0
Fixed PointD in MagickScript. Updated MagickScript

New Post: Tif separations

$
0
0
Is it possible to create images (tifs) for each separation (CMYK and spots) using Magick.Net?

I can do this directly with GhostScript, but just wondering if there is any wrapper for this via Magick.Net

New Post: Tif separations

$
0
0
Magick.NET/ImageMagick only reads the CMYK channels from files with Ghostscript spot colors are ignored. Are you using a PDF/EPS?, I was thinking about adding support for files that have extra spot colors. Can you provide me with a sample file so I can run some tests with it? And can you also tell me the Ghostscript command you are using?

New Post: CompositeOperator enum

$
0
0
Thanks, I see you released an update so I hope to get back and give this a try this week.
Viewing all 5763 articles
Browse latest View live


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