From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: Problem Building Ada Interface To ImageMagick 7
Date: Wed, 27 Jun 2018 05:34:34 -0700 (PDT)
Date: 2018-06-27T05:34:34-07:00 [thread overview]
Message-ID: <b944eb10-24e8-4826-9fe0-2fef0e2b1e34@googlegroups.com> (raw)
In-Reply-To: <43e020d3-653d-4a38-9795-a84966b50bf0@googlegroups.com>
On Tuesday, June 26, 2018 at 8:13:03 AM UTC-5, Roger wrote:
> On Tuesday, June 26, 2018 at 7:34:57 PM UTC+10, gautier...@hotmail.com wrote:
> > Is there something specific you want to do with ImageMagick ?
>
> The current specific thing I'm trying to do (in support of a larger project) is to get ImageMagick to read an image file and writing the image to another file.
One way to do this is to use gnat.os_lib spawn, and run the imagemagick executable. For example, I have this:
procedure To_Jpeg (I : in Cursor)
is
use GNAT.OS_Lib;
Filename : constant String := Element (I);
Ext_First : constant Integer := Filename'Last - 3;
Jpg_Filename : constant String := Filename (Filename'First .. Ext_First - 1) & ".jpg";
Success : Boolean;
begin
-- Calling 64 bit cygwin 'convert' from 32 bit native GNAT
-- screws up, so we use a 32 bit native install of ImageMagick.
Spawn ("d:/Apps/ImageMagick-7.0.3-Q8/magick.exe",
(new String'("convert"),
new String'(Filename),
new String'("-quality"),
new String'("50"), -- good for fine text, reasonably small
new String'(Jpg_Filename)), Success);
if not Success then
raise Ada.Text_IO.Use_Error with "convert failed";
end if;
File_Names.Replace_Element (I, Jpg_Filename);
end To_Jpeg;
next prev parent reply other threads:[~2018-06-27 12:34 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-26 8:28 Problem Building Ada Interface To ImageMagick 7 Roger
2018-06-26 9:26 ` alby.gamper
2018-06-26 11:58 ` Roger
2018-06-26 12:35 ` alby.gamper
2018-06-26 13:43 ` Roger
2018-06-27 2:08 ` Roger
2018-06-26 18:58 ` Jacob Sparre Andersen
2018-06-30 1:25 ` Roger
2018-06-26 9:34 ` gautier_niouzes
2018-06-26 11:51 ` Roger
2018-06-26 13:13 ` Roger
2018-06-26 16:28 ` gautier_niouzes
2018-06-26 17:47 ` Roger
2018-06-26 18:14 ` Roger
2018-06-26 18:38 ` gautier_niouzes
2018-06-27 2:11 ` Roger
2018-06-27 4:55 ` gautier_niouzes
2018-06-27 7:07 ` Roger
2018-06-27 7:28 ` gautier_niouzes
2018-06-27 8:05 ` Roger
2018-06-27 7:04 ` Dmitry A. Kazakov
2018-06-27 7:12 ` Roger
2018-06-27 9:59 ` gautier_niouzes
2018-06-27 12:34 ` Stephen Leake [this message]
2018-06-27 12:41 ` Roger
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox