This content has been marked as final. Show 4 replies
You should probably set the encoding of f2 to binary as well.
Good thinking but no luck, I've tried various ways to export it from InDesign and each time I still get a corrupt image. I'm wondering if somehow InDesign's File object isn't properly reading the image file, I've tested it with GIFs and JPGs so far and each has come out corrupted.
This works for me:
infile = File ("/c/indesign_scripts/Winter.jpg");
infile.encoding = "BINARY";
outfile = new File ("/c/indesign_scripts/Winter-1.jpg");
outfile.encoding = "BINARY";
infile.open ("r", undefined, undefined);
outfile.open ("w", undefined, undefined);
p = infile.read();
Thanks a lot for the advice, I believe the flaw was that I wasn't closing the file objects after finishing the process, which lead to the behavior I observed.