Error writing to file using Jpeg_write.mexmaci64
3 views (last 30 days)
Show older comments
Recently i moved my project to mac OS so i needed to compile jpeg toolbox c++ files and create jpeg_read.mexmaci64 and jpeg_write.mexmaci64.
after a lot of search and try, finally i did that.
when i used mex for jpeg_write, the compilation successfully completed but there was a warning to. i dont know it is important or not.
mex -compatibleArrayDims -I/usr/local/opt/jpeg/include ...
-I/usr/local/opt/gdcm/include/gdcm-3.0/gdcmjpeg ...
jpeg_write.c ...
-L/usr/local/opt/jpeg/lib -L/usr/local/opt/gdcm/lib ...
-ljpeg -lgdcmjpeg16
Building with 'Xcode with Clang'.
/Users/venus/Downloads/jpeg_toolbox/jpeg_write.c:357:42: warning: passing 'char *' to parameter of type 'const JOCTET *' (aka 'const unsigned char *') converts between pointers to integer types with different sign [-Wpointer-sign]
jpeg_write_marker(&cinfo, JPEG_COM, comment, strlen-1);
^~~~~~~
/usr/local/opt/jpeg/include/jpeglib.h:1031:22: note: passing argument to parameter 'dataptr' here
const JOCTET * dataptr, unsigned int datalen));
^
1 warning generated.
MEX completed successfully.
but when i run my project MATLAB returns me an error when it comes to jpeg_write.
Error using jpeg_write
Error writing to file.

this is the code from my project when the error happens:
jpeg_write(jpegobj,[dirStego '/' regexprep(files(w).name,'.png','.jpg')]);
can anyone help me? im confused!!
6 Comments
Walter Roberson
on 20 Nov 2020
I was able to get the code to compile without warning, but it crashed my MATLAB as soon as I did a jpeg_write, so unfortunately I do not have anything useful to hand over.
Answers (0)
See Also
Categories
Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!