Jump to page: 1 2 3
Thread overview
DMagick image processing with D.
Nov 02, 2011
Mike Wey
Nov 02, 2011
bearophile
Nov 03, 2011
Andrej Mitrovic
Nov 03, 2011
Mike Wey
Nov 03, 2011
Andrej Mitrovic
Nov 04, 2011
Mike Wey
Nov 04, 2011
Andrej Mitrovic
Nov 04, 2011
Mike Wey
Apr 08, 2012
nrgyzer
Apr 09, 2012
Mike Wey
Apr 09, 2012
Mike Wey
Nov 03, 2011
Andrej Mitrovic
Nov 03, 2011
Andrej Mitrovic
Nov 03, 2011
Mike Wey
Nov 03, 2011
Andrej Mitrovic
Nov 03, 2011
Andrej Mitrovic
Nov 03, 2011
Andrej Mitrovic
Nov 03, 2011
Andrej Mitrovic
Nov 03, 2011
Mike Wey
Nov 03, 2011
Andrej Mitrovic
Jun 20, 2013
fgimage
November 02, 2011
I'm happy to announce the first DMagick release.

DMagick is an object-oriented D API to the ImageMagick image-processing library. With an interface inspired by Magick++ and RMagick.

DMagick requires a recent D2 compiler >= 2.054 and works with ImageMagick 6.6.0 and up.

DMagick can be found here: http://code.mikewey.eu/p/DMagick/

Downloads: http://code.mikewey.eu/p/DMagick/downloads/
Documentation: http://dmagick.mikewey.eu/docs/

-- 
Mike Wey
November 02, 2011
Mike Wey:

> I'm happy to announce the first DMagick release.

This looks like a quite useful package.

Bye,
bearophile
November 03, 2011
sigmoidalContrast.d works, although draw.d doesn't:

Magick: unable to read font `@ghostscript_font_path@n019003l.pfb' @
error/annotate.c/RenderFreetype/1120.
Magick: unable to read font `@ghostscript_font_path@n019003l.pfb' @
error/annotate.c/RenderFreetype/1120.
dmagick.Exception.XServerError@dmagick\Image.d(1142): Magick: unable
to open X server `' @ error/display.c/DisplayImages/1662
----------------
4C004C
451F2B
40CCF0
415E4C
415E90
415A87
52F2C5
----------------

I guess displaying is only possible via X server? Otherwise I guess I could fetch the raw bytes of the image and display that via GDI/etc. I've seen a toBlob function in there somewhere, maybe I can use that.

I've never used this lib before but it will definitely come in handy. Thanks for your hard work, Mike!
November 03, 2011
Btw, with warnings turned on I get:
..\dmagick\Image.d(236): Warning: overrides base class function
object.Object.toString, but is not marked with 'override'
November 03, 2011
It would be easier not having to register on a custom website just to issue reports. But anyway this line triggers a runtime exception:

Line 256, dmagick/Image.d:
result ~= std.string.format("%sx%s%+ld%+ld ",
				imageRef.page.width, imageRef.page.height,
				imageRef.page.x,     imageRef.page.y);

std.format.FormatException@std\format.d(4094): formatArg

Personally, it's because of issues like this I never use any other specifier but %s. It's hard to track this down with no line numbers, and that exception message that points to internal code is completely useless. Ah, phobos...
November 03, 2011
I was trying to export pixels:
auto pixels = image.exportPixels!byte(area, "RGB");

But got:
..\dmagick\Image.d(1340): Error: cannot implicitly convert expression
(pixels) of type void[] to byte[]

I think you might need to change Line 1340, dmagick/Image.d: return pixels;

to this:
return cast(typeof(return))pixels;

Still, with this change I get an access violation in the statement before it that calls ExportImagePixels. Ddbg says:

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION(0xc0000005) at
CORE_RL_magick_.dll (0x100c1267) thread(3440)

These were my calls:
    Image image = new Image("newbitmap.bmp");
    int x, y;
    auto area = Geometry(100, 100, x, y);
    auto pixels = image.exportPixels!byte(area, "RGB");

newbitmap.bmp is a 614x768x8bit bitmap.
November 03, 2011
On 11/3/11, Andrej Mitrovic <andrej.mitrovich@gmail.com> wrote:
> Unhandled Exception: EXCEPTION_ACCESS_VIOLATION(0xc0000005) at
> CORE_RL_magick_.dll (0x100c1267) thread(3440)

I think I've found the issue:

void[] pixels = new T[area.width*area.height];

Here you're allocating width*height, but you didn't take into account that each exported channel specified by map will need more width*height storage. Here's what I did to fix it:

import std.utf;
auto pixels = new T[]((area.width * area.height) * map.count);
// call ExportImagePixels
return pixels;

I think the DLL tried to write to memory beyond what the GC allocated for the array, and hence the access violation.
November 03, 2011
Ok I'll stop spamming here and report on your site, here's issue 1: http://code.mikewey.eu/p/DMagick/issues/1/
November 03, 2011
I've started a new repo where I'll be writing some DMagick (win32) sample apps. I have a simple one now that loads an image to a DibSection and blits it to the screen:

https://github.com/AndrejMitrovic/DMagickSamples

Note that I've had to add a couple of fixes to the library, so I'm distributing it with the samples.
November 03, 2011
On 11/03/2011 06:43 PM, Andrej Mitrovic wrote:
> I've started a new repo where I'll be writing some DMagick (win32)
> sample apps. I have a simple one now that loads an image to a
> DibSection and blits it to the screen:
>
> https://github.com/AndrejMitrovic/DMagickSamples
>
> Note that I've had to add a couple of fixes to the library, so I'm
> distributing it with the samples.

I've merged in the the fixes you added.

I see that you have removed the shared static this from Image.d, is initializing ImageMagick unnecessary on Windows?
I've never tested without initializing though.

-- 
Mike Wey
« First   ‹ Prev
1 2 3