Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
douglas.paulino
Posts: 4 Joined: 2016-04-18T12:47:10-07:00
Authentication code: 1151
Post
by douglas.paulino » 2016-04-18T12:57:04-07:00
Folks
Can someone show me what api at C should I use to convert PDF to PNG? Must perform this conversion on android and am having trouble for it.
Follow my attempt:
Code: Select all
JNIEXPORT void JNICALL Java_magick_Pdf_pdfToPng
(JNIEnv *env, jobject self)
{
printf("Hello World!\n");
int args_count;
char *args[] = { "convert", "-density", "300", "/storage/emulated/0/files/pdftopng.pdf",
"/storage/emulated/0/files/pdftopng.png"};
for(args_count = 0; args[args_count] != (char *)NULL; args_count++);
ImageInfo *image_info = AcquireImageInfo();
ExceptionInfo *exception = AcquireExceptionInfo();
MagickBooleanType status =
ConvertImageCommand(image_info, args_count, args, NULL, exception);
if (exception->severity != UndefinedException)
{
status=MagickTrue;
CatchException(exception);
}
if (status == MagickFalse)
fprintf(stderr, "Error in call\n");
image_info=DestroyImageInfo(image_info);
exception=DestroyExceptionInfo(exception);
}
I need to set the density and I'm having trouble...... I'm on the correct track?
tks
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Post
by snibgo » 2016-04-18T13:10:22-07:00
What trouble are you having?
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2016-04-18T13:17:13-07:00
Please always provide your IM version and Platform.
douglas.paulino
Posts: 4 Joined: 2016-04-18T12:47:10-07:00
Authentication code: 1151
Post
by douglas.paulino » 2016-04-19T05:11:27-07:00
Follow the error on Android
04-19 09:06:22.734: A/DEBUG(274): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
04-19 09:06:22.735: A/DEBUG(274): Build fingerprint: 'motorola/osprey_retla_ds/osprey_uds:6.0/MPI24.65-33.1/1:user/release-keys'
04-19 09:06:22.735: A/DEBUG(274): Revision: 'p2b0'
04-19 09:06:22.735: A/DEBUG(274): ABI: 'arm'
04-19 09:06:22.735: A/DEBUG(274): pid: 20453, tid: 20453, name: teste.ndk >>> teste.ndk <<<
04-19 09:06:22.735: A/DEBUG(274): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
04-19 09:06:22.756: A/DEBUG(274): r0 be965b6c r1 00000000 r2 00001000 r3 00000000
04-19 09:06:22.756: A/DEBUG(274): r4 00001000 r5 be965b6c r6 00000000 r7 b85da824
04-19 09:06:22.756: A/DEBUG(274): r8 be96dd60 r9 00000000 sl b85d2638 fp b85d7750
04-19 09:06:22.756: A/DEBUG(274): ip be966b6b sp be965b5c lr a43fbf43 pc a4446a3a cpsr 200d0030
04-19 09:06:22.775: I/ActivityManager(2499): Start proc 20487:com.google.android.apps.plus/u0a96 for broadcast com.google.android.apps.plus/.service.PackagesMediaMonitor
04-19 09:06:22.780: A/DEBUG(274): backtrace:
04-19 09:06:22.780: A/DEBUG(274): #00 pc 000c6a3a /data/app/teste.ndk-1/lib/arm/libimagemagick.so (CopyMagickString+9)
04-19 09:06:22.780: A/DEBUG(274): #01 pc 0007bf3f /data/app/teste.ndk-1/lib/arm/libimagemagick.so (GetExceptionMessage+50)
04-19 09:06:22.780: A/DEBUG(274): #02 pc 00137673 /data/app/teste.ndk-1/lib/arm/libimagemagick.so
04-19 09:06:22.780: A/DEBUG(274): #03 pc 0005d7a3 /data/app/teste.ndk-1/lib/arm/libimagemagick.so (ReadImage+402)
04-19 09:06:22.780: A/DEBUG(274): #04 pc 0005e18b /data/app/teste.ndk-1/lib/arm/libimagemagick.so (ReadImages+246)
04-19 09:06:22.780: A/DEBUG(274): #05 pc 000d3263 /data/app/teste.ndk-1/lib/arm/libimagemagick.so (ConvertImageCommand+1694)
04-19 09:06:22.780: A/DEBUG(274): #06 pc 00045f89 /data/app/teste.ndk-1/lib/arm/libimagemagick.so (Java_magick_Pdf_pdfToPng+80)
04-19 09:06:22.780: A/DEBUG(274): #07 pc 000238bd /data/app/teste.ndk-1/oat/arm/base.odex (offset 0x13000) (void magick.Pdf.pdfToPng()+72)
04-19 09:06:22.780: A/DEBUG(274): #08 pc 00029a9b /data/app/teste.ndk-1/oat/arm/base.odex (offset 0x13000) (void teste.ndk.AndroidMagickActivity.onCreate(android.os.Bundle)+926)
04-19 09:06:22.781: A/DEBUG(274): #09 pc 02762495 /system/framework/arm/boot.oat (offset 0x1fde000)
04-19 09:06:22.813: I/AccountManagerService(2499): getTypesVisibleToCaller: isPermitted? true