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: Using async/await to prevent MagickCacheErrorException
↧
New Post: Magick Script & Composite
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
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?
I have a possible issue when writing to an open stream. My code works like this:
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
- Open a file stream called destinationStream:
- create MagickImage object
- call object.Write(destinationStream) which works fine
- create MagickImage object2
- call object2.Merge() to add a watermark
- call object2.Write(destinationStream) which seems to work fine
-
dispose of destinationStream
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?
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:
You should only write the result of the Merge method to the destinationStream.
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?
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
↧
New Post: Writing to an already open stream?
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
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
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
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.
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
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.
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
Got it. I'll try figure out some other way.
↧
↧
New Post: Converting 2 pages TIF Files to jpg
Hi dlemstra,
Thanks for the new release. I'm gonna try it now. Thanks again.
Thanks for the new release. I'm gonna try it now. Thanks again.
↧
New Post: Converting 2 pages TIF Files to jpg
workstation22 wrote:
Hi dlemstra,It worked! Thank you so much dlmenstra!
Thanks for the new release. I'm gonna try it now. Thanks again.
↧
New Post: Performance Issues - taking to much time to convert images
Hi All,
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.
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:
320x240640x480
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
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?
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
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)
So it is slow when the cpu get the 100%.
Thanks, Cristian.
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?
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?
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");
↧