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

New Post: Using async/await to prevent MagickCacheErrorException

$
0
0
Thanks! I implemented it and it works great. It does not seem much slower with 2 threads in comparison to having all available threads working on it, but at least I am sure that 20 threads will not try opening 30MP images and run out of memory.

New Post: Magick Script & Composite

$
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: Layers with distort perspective

$
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: Writing to an already open stream?

$
0
0
I have a possible issue when writing to an open stream. My code works like this:
  1. Open a file stream called destinationStream:
  2. create MagickImage object
  3. call object.Write(destinationStream) which works fine
  4. create MagickImage object2
  5. call object2.Merge() to add a watermark
  6. call object2.Write(destinationStream) which seems to work fine
  7. dispose of destinationStream
The resulting file is an image that is twice the size(2MB) that it should be and the image does not have the watermark. If I dispose of the destinationStream between the two write calls, and then reopen the stream everything works fine. Also, the file size is 1MB, not 2MB.

Is it possible that Magick requires my file stream to be closed/reopened between writes to produce the desired effect? And if you think this is simply a C# file stream thing, then disregard.

Thanks

New Post: Writing to an already open stream?

$
0
0
Aren't you missing a step in the example above? Step 5 calls Merge of object2 but MagickImage does not contain a Merge method. You probably created a MagickImageCollection at some point.

The reason you are not seeing the watermark is because you are writing two images to the stream instead of only one. An image looks something like this:
+------------------+
| Header of image  |
| +--------------+ |
| | Size of data | |
| +--------------+ |
+------------------+
| Image data       |
+------------------+
If your image contains more data then specified in the header it is considered to be garbage. Some image readers will raise an error but most readers will just ignore the rest after the 'Image data' block.

You should only write the result of the Merge method to the destinationStream.
using (MagickImageCollection images = new MagickImageCollection())
{
  images.Add("image.png");
  images.Add("watermark.png");
  using (MagickImage result = images.Merge())
  {
    result.Write(destinationStream);
  }
}

New Post: Writing to an already open stream?

$
0
0
I apologize for my pseudo code not being 100% accurate. I am in fact creating an MagickImageCollection and calling Merge on that guy, so we're good there. The second thing is that my code looks almost identical to yours in terms of writing the result of the Merge to the stream. Since the file size is being doubled, my guess is that the second write is successful but possibly on another layer perhaps, instead of overwriting the result of the first Write call.

New Post: Using montage command with Magick.NET

$
0
0
Hi,

I could not find a way to reproduce result of montage in Magick.NET.

Can you help?

Best,
Kerem

New Post: Writing to an already open stream?

$
0
0
I think you should read my reply again. Each write action creates one image. When you write two MagickImages to the same stream they don't automatically get merged. And it also does not mean that layers are being created.

New Post: Using montage command with Magick.NET

$
0
0
Montage is not supported at the moment. I will create a work item to add this in the future.

New Post: Using montage command with Magick.NET

$
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: Using montage command with Magick.NET

$
0
0
Thank you.

I read a comment on previous discussion. "Everything that is possible with MagickScript is possible with the classes of Magick.NET."

Can't we use command-line string to use imagemagick api directly? I don't need typed methods.

New Post: Using montage command with Magick.NET

$
0
0
I think you are mixing something up. MagickScript is an xml 'language' for executing methods in the Magick.NET classes it is not included in ImageMagick. And the everything should probably be almost everything :).

It could be possible to let you directly execute the ImageMagick command line but I really prefer to use typed methods. Feel free to give suggestions for new methods that would make it easier for you to execute commands with typed methods.

New Post: Using montage command with Magick.NET

$
0
0
Got it. I'll try figure out some other way.

New Post: Converting 2 pages TIF Files to jpg

$
0
0
Hi dlemstra,

Thanks for the new release. I'm gonna try it now. Thanks again.

New Post: Converting 2 pages TIF Files to jpg

$
0
0
workstation22 wrote:
Hi dlemstra,

Thanks for the new release. I'm gonna try it now. Thanks again.
It worked! Thank you so much dlmenstra!

New Post: Performance Issues - taking to much time to convert images

$
0
0
Hi All,
  We are using a Window Service to read messages from a Message Queue Server, then we use Magick.NET to convert the photos into 3 different size: 
320x240
640x480
1280x720

The size og the images we are tryng to upload are almost 5mb.

When we tried to convert like 200 photos reading from the Queue took a very long time, we were using the 6.8.8.201 64bit 16Q, reading other post we change to the lastest version of 64bits 8Q, in order to improve the performance since the Q8 version dont use HDRI.

Is there some else that we can do to improve it?

Wonderfull library it is helping us a lot!
Thanks, Cristian.

New Post: Performance Issues - taking to much time to convert images

$
0
0
Are you converting multiple images at the same time? If you convert too much images at the same time you can run out of memory and Magick.NET will switch to disk cache which is terribly slow.

Have you measured which part of your action is slow? Is it reading/writing of the image or is it the resize action? And what do you consider slow?

New Post: Performance Issues - taking to much time to convert images

$
0
0
Hi dlemsta,

Thank you for you fast answer.
-Are you converting multiple images at the same time?
No we are converting one a time.
-Have you measured which part of your action is slow?
Well the think it is consuming 100% of the CPU. So take make it slowly. I dont now exactly what is causing it.
-Is it reading/writing of the image or is it the resize action?

if (img.Height > img.Width)
            {
                img.Resize(0, maxHeight);
            }
            else
            {
                img.Resize(maxWidth, 0);
            }
            img.Composite(wtmark, Gravity.Southeast, CompositeOperator.Atop);
-And what do you consider slow?
So it is slow when the cpu get the 100%.

Thanks, Cristian.

New Post: Best approach to create PDF -> PNG thumbnails on an Azure Web Site?

$
0
0
I was thinking about using Magick.NET to create PNG thumbnails of PDFs that are uploaded to a website. However, the website is hosted on Azure Web Sites and therefore I cannot install Ghostscript on the machine. Is there any way to use Magick.NET to do this without having to install Ghostscript?

New Post: Best approach to create PDF -> PNG thumbnails on an Azure Web Site?

$
0
0
It should be possible to use Ghostscript without installing it. You should first download and install Ghostscript on your own machine. If you want to use the x64 version of Magick.NET you should install the x64 version of Ghostscript. You need to install it because you need to copy the file gsdll64.dll or gsdll32.dll to your project/website. I have not tested this so you might have to copy the dll into your bin directory before it works. You could try to place it somewhere else first. Before you use Magick.NET in your website make sure you do the following call:
MagickNET.SetGhostscriptDirectory(@"c:\directory\where\you\put\the\dll\of\ghostscript");
Viewing all 3693 articles
Browse latest View live