So, how can I use the API to generate output like this?
69871: ( 0, 0, 0, 0) #00000000 none
1: ( 18, 18, 18,255) #121212 grey7
1: ( 23, 23, 23,255) #171717 grey9
2: ( 26, 26, 26,255) #1A1A1A grey10
1: ( 33, 33, 33,255) #212121 grey13
5: ( 46, 46, 46,255) #2E2E2E grey18
7: ( 51, 51, 51,255) #333333 grey20
4: ( 54, 54, 54,255) #363636 grey21
2: ( 56, 56, 56,255) #383838 grey22
5: ( 61, 61, 61,255) #3D3D3D grey24
Code:
Code: Select all
// outputFilePath is of the form "/foo/bar/baz/123456789_color_distribution.txt"
outputPathChars = (*env)->GetStringUTFChars(env, outputFilePath, JNI_FALSE);
finalOutputPath = malloc(snprintf(NULL, 0, "%s%s", "histogram:info:", outputPathChars) + 1);
sprintf(finalOutputPath, "%s%s", "histogram:info:", outputPathChars);
MagickSetImageDepth(wand, 8);
printf("Attempting to write histogram text file to %s\n", finalOutputPath);
MagickSetImageFormat(wand, "%c");
status = MagickWriteImage(wand, finalOutputPath);
Code: Select all
outputPathChars = (*env)->GetStringUTFChars(env, outputFilePath, JNI_FALSE);
finalOutputPath = malloc(snprintf(NULL, 0, "%s", outputPathChars) + 1);
sprintf(finalOutputPath, "%s", outputPathChars);
MagickSetImageDepth(wand, 8);
printf("Attempting to write histogram text file to %s\n", finalOutputPath);
MagickSetImageFormat(wand, "%c histogram:info");
status = MagickWriteImage(wand, finalOutputPath);
I'm sure I'm missing something that should be really obvious, but it's probably just too obvious for me to see it.