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

New Post: Magick.NET and Mono


New Post: Drawing Italic / Different font text

$
0
0
Thank you for the quick response. However, that still didn't work - see image. It is not using the specified font family and it is not honoring the italics, font weight etc.
using (var working = new MagickImage(@"c:\temp\filename.jpg"))
{
    // Draw text
    working.StrokeColor = new MagickColor("#FFFFFF");
    working.FillColor = working.StrokeColor;
    working.Font = "Tahoma";
    working.FontPointsize = 24f;

    using (var piFont = new DrawableFont("Tahoma", FontStyleType.Italic, FontWeight.Weight700, FontStretch.Normal))
    {
        var list = new List<Drawable>();
        list.Add(piFont);
        var metrics = working.FontTypeMetrics("Why hello there!");
        using (var piText = new DrawableText(10, working.Height - metrics.TextHeight - 10, "Why hello there!"))
        {
            list.Add(piText);
            working.Draw(list);
        }
    }
}
Also when doing it as a list like that, how do you measure text (FontTypeMetrics) with the correct font? An italic, heavy font will be wider than a non-italic light font.

Image

New Post: Drawing Italic / Different font text

$
0
0
Found a workaround. You can't make any arbitrary font bold or italic and you can't use DrawableFont at all. but just using the Font and FontPointsize properties works as long as you format the font name like ImageMagick expects:
using (var working = new MagickImage(@"c:\temp\filename.jpg"))
{
    // Draw text
    working.StrokeColor = new MagickColor("#FFFFFF");
    working.FillColor = working.StrokeColor;
    working.Font = "Arial-Bold-Italic";
    working.FontPointsize = 24f;

    var metrics = working.FontTypeMetrics("Why hello there!");
    using (var piText = new DrawableText(10, working.Height - metrics.TextHeight - 10, "Why hello there!"))
    {
            working.Draw(piText);
    }
}

New Post: Drawing Italic / Different font text

$
0
0
Are you aware of the 'DrawableGravity' class? You can use that to position your text. Then you won't have to do the calculations yourself.

New Post: Quality Resolution - Create a PDF file from two images:

$
0
0
Copied from issue:

Hello, you can reduce the quality / resolution of the converted images to PDF? Using this code:

Create a PDF file from two images:

using (MagickImageCollection collection = new MagickImageCollection())
{

//Resolution ??????

collection.Add(new MagickImage("SnakewarePage1.jpg"));
collection.Add(new MagickImage("SnakewarePage2.jpg"));

collection.Write("Snakeware.pdf");
}


how can I insert value? thanks

New Post: Quality Resolution - Create a PDF file from two images:

$
0
0
You have to set the resolution and the quality on the image. You cannot set it on the whole collection. It should be something like this:
using (MagickImageCollection collection = new MagickImageCollection())
{
  collection.Add(new MagickImage("SnakewarePage1.jpg"));
  collection[0].Density = new MagickGeometry(72, 72);
  collection.Add(new MagickImage("SnakewarePage2.jpg"));
  collection[1].Density = new MagickGeometry(72, 72);

  collection.Write("Snakeware.pdf");
} 

New Post: Drawing Italic / Different font text

$
0
0
I was aware of it, but I didn't know how to handle padding. Now that I've figured that out it does make it significantly easier to place the text. Thank you

New Post: didn't find how to set progressive jpeg or interleace

$
0
0
Congratulations!
this .NET project is a wonderful job. It make image handling with magick a lot easier in NET environments.
I will appreciate if someone could help to find the right way to save the magickImage object as progressive jpeg (and optionally specify the jpeg sampling method)

(my magickImage object was created with "new MagickImage(color, width,height)" and has been modified with writablePixels, now just need to save it as progressive jpeg with specific quality and optionally different subsampling.)

Try several methods, attributes,, formats, options, properties without success.
Hope you can help.
Thank you in advance.

dll version: Magick.NET-6.8.6.301-Q8-x86-net40-client

New Post: Old-style JPEG compression

$
0
0
Hello,

How to configure Magick.NET to support the old-style jpeg compression?

I'm trying to extract a page from a multi-page tiff and save it as a separate single-page tiff file. However this conversion produces a completely empty image (black background).
I tried to perform the conversion via command line calling ImageMagick directly and I received the following error:
convert.exe: Depreciated and troublesome old-style JPEG compression mode, please convert to new-style JPEGcompression and notify vendor of writing software. `OJPEGSetupDecode' @ warning/tiff.c/TIFFWarnings/824.convert.exe: Improper call to JPEG library in state 0. `LibJpeg' @ error/tiff.c/TIFFErrors/562.
Is there a way around this?

Thanks

New Post: didn't find how to set progressive jpeg or interleace

$
0
0
You can write an progressive image like this:
using (MagickImage image = new MagickImage("input.png"))
{
  // Set the format and write to a stream so ImageMagick won't detect the file type.
  image.Format = MagickFormat.Pjpeg;
  using (FileStream fs = new FileStream("output.jpg", FileMode.Create))
  {
    image.Write(fs);
  }
  // Write to .jpg file
  image.Write("PJEG:output.jpg");
  // Or to a .pjpeg file
  image.Write("output.pjpg");
}
At this moment you are unable to set the the jpeg specific options. I will create a workitem to resolve this. Do you want to change the jpeg sampling factor (http://www.imagemagick.org/script/command-line-options.php#sampling-factor) or something else?

New Post: didn't find how to set progressive jpeg or interleace

$
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: didn't find how to set progressive jpeg or interleace

$
0
0
it works !! (just save the file with pjpg extension)
Your perfect and quick answer probe that you are working on this project seriously.

Thank you very much.

Regarding the subsampling option, you are pointing to the right direction. (sampling-factor)

I was using image and pixel manipulation with the native .net tools for years with success.
The fundamental reason to start using imageMagic and your excellent .Net wrapper is the progressive and subsampling definitions (you can read, but you can't save an image with standard .NET framework with the progressive jpeg feature)

Thank you one more time for all your help. You are doing an excellent job.

I will follow the discussion of the sampling-factor.

New Post: Old-style JPEG compression

$
0
0
You are actually receiving a warning and an error. The message Improper call to JPEG library in state 0 is an error and causes ImageMagick to stop reading the image. I would however expect Magick.NET to raise an exception. Only warnings will be ignored during a read operation. Would you mind sharing your image with me so I can investigate this? You can also contact me trough codeplex if you don't want to post your image online.

New Post: didn't find how to set progressive jpeg or interleace

$
0
0
With the next release (will be published in a couple of weeks) you will be able to do this:
image.SetOption(MagickFormat.Jpeg, "sampling-factor", "4x1,2x1,2x1");

New Post: didn't find how to set progressive jpeg or interleace

$
0
0
It will be wonderful. ImageMagick.net developers will appreciate that.
Thank you.
Happy to include credits in the final product.

New Post: Convert PDF to a set of PJPEG files

$
0
0
Hi, thank you for such nice library!
I've read examples and now trying to convert PDF to a set of progressive JPG files, but i didn't succeed.
MagickReadSettings settings = new MagickReadSettings();
settings.Density = new MagickGeometry(144, 144);

settings.ColorSpace = ColorSpace.sRGB;

using (MagickImage coverPage = new MagickImage())
{
    coverPage.Format = MagickFormat.Pjpeg;

    coverPage.Quality = 80;

    coverPage.Read(fileName + "[0]", settings);
    
    coverPage.Write(WritePath);
}
Image is not saved as PJPEG. It works only when i add PJPEG: before filepath.
string WritePath = String.Format("PJPEG:{0}.jpg", OutPath);
I can go this way, but there is other issue: i want to have output images of fixed size (max height ~500px)

when i try to call
coverPage.Resize(0, 500);
before saving image, it sized but have a black background:

Image

what am i doing wrong? what is the best way to solve this?

Regards,
Denis

New Post: Convert PDF to a set of PJPEG files

$
0
0
The black pixels are probably transparent pixels. You can give them a color using this method:
coverPage.ColorAlpha(new MagickColor("#fff"));

New Post: Convert PDF to a set of PJPEG files

$
0
0
Tried this, no chnages.

Here is Sample PDF

after converting i've got this Image (no black background, but image not resized)

while using resize i have black background:

Image

New Post: Convert PDF to a set of PJPEG files

$
0
0
Solved this via ImageMagick in commandline:
convert.exe -colorspace sRGB -interlace line -density 144x144 -quality 100 -resize 500x500 -background white -alpha remove d:\test.pdf d:\test.jpg
how can i execute the same using Magick.Net: -background white -alpha remove ?

New Post: Convert PDF to a set of PJPEG files

$
0
0
Very interesting, everything okay when i first save PDF page as image, reopen it and perform needed actions:
MagickReadSettings settings = new MagickReadSettings();

settings.Density = new MagickGeometry(144, 144);

// 1 step - read PDF first page, and save it as JPEG image

using (MagickImage coverPage = new MagickImage())
{
    coverPage.Read(fileName + "[0]", settings);

    coverPage.Write(WritePath);
}

// 2 step - reopen just created file, resize and overwrite

using (MagickImage image = new MagickImage(WritePath))
{
    image.Format = MagickFormat.Pjpeg;

    // max height = 500px, width is calculated by library
    image.Resize(0, 500);

    image.Write(WritePath);
}
anyway, thanks for such good library!
Viewing all 3693 articles
Browse latest View live


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