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

New Post: Padding out Thumbnails

$
0
0
You are looking for the Extent method:
using (MagickImage image = new MagickImage(Color.Yellow, 600, 1000))
{
  image.Resize(100, 100);
  image.BackgroundColor = MagickColor.Transparent;
  image.Extent(100, 100, Gravity.Center);
  image.Write("yellow.png");
}

New Post: Padding out Thumbnails

$
0
0
Jackpot, exactly what I was looking for, thanks!

New Post: Layers with distort perspective

$
0
0
It took me a while but I think I have a solution for you:
// Magick.NET understands the ~ prefix.var first = new MagickImage(@"~\files\house.jpg");
var second = new MagickImage(@"~\files\monkey.jpg");

double[] args =
{
  // Move 0x0 to 105x54
  0,0, 105,54,
  // Move 0x120 to 105x152
  0,second.Height, 105,152,
  // Move 180x0 to 163x76
  second.Width,0, 163,76,
  // Move 180x120 to 163x122
  second.Width,second.Height, 163,122
};

// Extend the second image if it does not fit in the first image.if (second.Height < first.Height || second.Width < first.Width)
{
  second.BackgroundColor = MagickColor.Transparent;
  second.Extent(first.Width, first.Height);
}

// Perform the distortion.
second.HasAlpha = true;
second.VirtualPixelMethod = VirtualPixelMethod.Transparent;
second.Distort(DistortMethod.Perspective, args);

// Draw second image on top of first image.
first.Composite(second, Gravity.Northwest, CompositeOperator.SrcOver);
first.Write(@"~\files\house_with_paint.jpg");

New Post: Layers with distort perspective

$
0
0
Thank you so much man!
2 books from your gift list is on its way :)

New Post: Layers with distort perspective

$
0
0
Thank you very much. I send you a message through Codeplex, can you please reply the e-mail?

New Post: Possible issue writing to stream

$
0
0
Thank you very much. I was really sure that I tried that, Your documentation was very clear so I guess I didn't try it when I thought I did. Thanks again.

New Post: Using async/await to prevent MagickCacheErrorException

$
0
0
I have tried for each image in the listbox to do
private void ExtractThumbnail()
{
  Task.Factory.StartNew(() =>
  {
    using (MagickImage image = new MagickImage(fullPath))
    {
        image.Thumbnail(0, 100);
        ImageSource mythumb = loadBitmap(image.ToBitmap());
        if (mythumb.CanFreeze) mythumb.Freeze();
        Thumbnail = mythumb;
    }
but that leads to ImageMagick.MagickCacheErrorException.

Without Task.Factory it does not give me the error but UI is completely unreponsive until all images are there.

If I don't use Taks.Factory and set
<Image Source="{Binding Thumbnail, IsAsync=True}"
then I get the error again

Is there a way to use async/await on the line
using (MagickImage image = new MagickImage(fullPath))
or some other way to prevent the error and get all thumbnails?

New Post: Using async/await to prevent MagickCacheErrorException

$
0
0
How many images are you trying to load and did you change the ResourceLimits? What is the message in the MagickCacheErrorException?

Does the image.ToImageSource() method not work for you or don't you know it exists?

New Post: Magick Script & Composite

$
0
0
Hi,

in this exemple :
<msl>
  <read>
    <virtualPixelMethod value=""Transparent""/>
    <backgroundColor value=""Transparent""/>
    <composite x=""0"" y=""0"" compose=""Darken"">
      <!--<image fileName=""out\\futmask2.png""/>-->
      <image id=""mask""/>
    </composite>
  </read>
</msl>
Can i extend the second image (out\futmask2.png or id=mask) inside the same script before the composite ?

USWebCoatedSWOP isn't available in enumeration ?
<addProfile>
      <colorProfile name="USWebCoatedSWOP"/>
    </addProfile>
Best regards,

New Post: Layers with distort perspective

$
0
0
Hi,

Can we do the same thing with a script ?
// Magick.NET understands the ~ prefix.
var first = new MagickImage(@"~\files\house.jpg");
var second = new MagickImage(@"~\files\monkey.jpg");

double[] args =
{
  // Move 0x0 to 105x54
  0,0, 105,54,
  // Move 0x120 to 105x152
  0,second.Height, 105,152,
  // Move 180x0 to 163x76
  second.Width,0, 163,76,
  // Move 180x120 to 163x122
  second.Width,second.Height, 163,122
};

// Extend the second image if it does not fit in the first image.
if (second.Height < first.Height || second.Width < first.Width)
{
  second.BackgroundColor = MagickColor.Transparent;
  second.Extent(first.Width, first.Height);
}

// Perform the distortion.
second.HasAlpha = true;
second.VirtualPixelMethod = VirtualPixelMethod.Transparent;
second.Distort(DistortMethod.Perspective, args);

// Draw second image on top of first image.
first.Composite(second, Gravity.Northwest, CompositeOperator.SrcOver);
first.Write(@"~\files\house_with_paint.jpg");

New Post: .tif Format?

$
0
0
I noticed that .tif (three letter designation) is not listed under the MagickFormat list. There's only .tiff(four letter designation), but there is .jpg and .jpeg.

Is there a specific reason for this?

New Post: .tif Format?

$
0
0
The official name is Tagged Image File Format. ImageMagick/Magick.NET can load .tif because it is registered as a 'hidden alias'. I have not added the 'hidden aliases' to MagickFormat. I will add it to the enumeration so you can also use MagickForm.Tif in the next version of Magick.NET.

New Post: Magick Script & Composite

$
0
0
I forgot to add the recently added colorprofiles to the MagickScript enumeration. I will fix this in the next release of Magick.NET.

What do you mean by extend the second image, do you want to do something like this:
<msl><read><compositex="0"y="0"compose="Darken"><imageid="mask"><addProfile><colorProfilename="USWebCoatedSWOP"/></addProfile></image></composite></read></msl>

New Post: Using async/await to prevent MagickCacheErrorException

$
0
0
It looks like several magick huge tempfiles (up to 1GB) filled up HDD and the error was that there was not enough space. I erased all those files and now there are no errors any more even with TaskFactory.
I did not know how to use ResourceLimits in the above code. I have ObservableCollection of FileData in which I have above the method. I believe it creates as many as it can fit in threadpool. Is there still better way to use your library that you can recommend?

Great that you have implemented ToImageSource(), I will switch to yours.

New Post: Using async/await to prevent MagickCacheErrorException

$
0
0
You don't have to use ResourceLimits, I was just wondering if you did.

Magick.NET can leave tempfiles if it exists abnormally (for example stopping the debugger in the middle of execution). Magick.NET will use tempfiles when there is not enough memory available. And this really slows down the execution. Maybe you should lower the size of your threadpool to make sure all your images can fit inside the memory. This should be faster then using disk cache.

p.s. I contacted your through Codeplex to ask you if you can check if https://magick.codeplex.com/workitem/1188 is fixed.

New Post: Layers with distort perspective

$
0
0
No you can't. MagickScript does not support if statements. I might add this in the future. And the .Distort method is also not supported at the moment.

New Post: Using async/await to prevent MagickCacheErrorException

$
0
0
Is it possible to create separate thread pool for this operation only? Maybe it would be enough to have one? How CPU intensive is loading image and resizing it; does is make sense to have threads?

New Post: Using async/await to prevent MagickCacheErrorException

$
0
0
It really depends on the type of image how CPU intensive reading your image is. And the more pixels you have the longer it takes to resize.

It does make sense to have threads but maybe you should use the LimitedConcurrencyLevelTaskScheduler (an example can be found here: http://msdn.microsoft.com/en-us/library/ee789351.aspx) to limit the number of threads.

New Post: Magick Script & Composite

$
0
0
Like This :
<msl>
  <read>
    <composite x="0" y="0" compose="Darken">
      <image id="mask">
         <extent width="100" height="100" gravity="Center" backgroundColor="#fff" />      
      </image>
    </composite>
  </read>
</msl>

New Post: Layers with distort perspective

$
0
0
Can you add Distort method please ?

Best regards
Viewing all 3693 articles
Browse latest View live


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