unoconv is used to convert various file formats to PDF in the grading interface. Unfortunately, it does not yet support converting the relatively new HEIF High Efficiency Image File Format image format to PDF. Apple's latest iOS devices save camera photographs in this format by default, yet with a misleading .jpeg extension. Moodle's unoconv tool tries to convert to PDF, fails, and shows an error to instructors. When they go to grade they see an error message and are unable to. Here's an example from one instructor:
"A set of images submitted by a student does not allow the grading page to formulate a PDF for viewing the images. There is an error that comes up as the grading is starting (see attachments). Images are downloadable, but when trying to apply a grade, there is an error (see attachments)."
Here are the two attachments:
As they note, the images are present and viewable after download. All Moodle has to do is not insist on trying this broken PDF conversion, but it does and fails gracelessly.
Has anyone else found a solution to HEIF image PDF conversion on Moodle's end? While it's certainly undesirable that images cannot be converted, the fundamental problem is that Moodle throws such an impassable error. Just because a PDF cannot be created doesn't mean faculty shouldn't be able to grade the submission at all. I think part of what is making the fail state so bad is that unoconv thinks it should be able to convert this apparently ".jpeg" file when in fact it cannot. Many other file formats cannot be converted to PDF but do not encounter this error because unoconv knows it cannot convert them.
I found another forum post about a sort of related problem of handling the varying file extensions of JPG files but I'm not sure I can edit the unoconv file itself to work around this problem. Perhaps we need to edit unoconv to check the actual mimetype of the file (honestly not sure why this isn't what it does already? filename extensions are often misleading) and exit instead of creating a broken PDF? I feel like this would encounter the same problem, unfortunately, but am willing to try it.
There are a few work arounds on the user side (found in this article, I suspect some of these settings have changed locations since):
- save images in actual JPEG format (Settings > Camera > choose "Most Compatible" image format and not High Efficiency)
- transfer images in a compatible format (Settings > Photos > choose to automatically convert images before transfer). This will work if, for instance, you email the image to youself, but will not work if you use Air Drop (presumably because Apple thinks "Oh this is another Apple device, it can read HEIF, there's no need to convert")
- manually convert images before uploading e.g. using Preview.app to save as JPEG
The problem is, not all users are going to follow these instructions, no matter how hard we try to communicate them. We cannot force people to change poorly described settings nested layers deep on their personal devices.
I found (and already voted for) MDL-69554. Is there anything else that can be done? We cannot really afford to switch away from unoconv since it works 99% of the time but the quantity of HEIF problems is still significant. I'm going to look at the code for the unoconv document converter but I'm also loathe to monkey patch Moodle.