-
Notifications
You must be signed in to change notification settings - Fork 281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API (possibly) not supplying full preview data #16
Comments
Gentlemen: Can you attach a test file to this issue, please? I'm very surprised by what's being discussed. I will investigate this today when you provide a suitable test image. |
I've found your test file source.dng
The image is extracted (as a binary blob) here:
And the preview file is written by this code which is effectively fopen(path,"wb"); fwrite ; fclose.
|
Sorry, I should have added that. When I get home I will attach |
Do you have any thoughts about what the issue is? This sort of thing is usually me being stupid :) @myfreeweb is the expert on how the C Bindings work but what you say seems right to me. |
I haven't looked in your code. It appears to me that the library extracts the preview and writes it to file in a simple operation. Without reproducing your code, I have nothing to investigate. I have attached your file. |
Thanks for sharing your code. Here's the code in src/actions.cpp which is used by the exiv2(.exe) command-line program:
I'm wondering if you're corrupting buffers or storing exiv2 pointers in your vector. Be careful, these are smart pointers. Be sure to allocate your own memory to store the preview in your environment. I have to shoot off at the moment. If you're confused, please shout and I'll go through your code later. |
|
I looked quickly at your code and saw the new data[size] stuff. You do appear to be copying the image. Let's not get into a smart argument, let's focus on finding what's wrong. Is it possible to sprintf/log as this code executes. For example write the preview from the library immediately when you retrieve it (using a something like actions.cpp/writePreviewFile). Compare what the library delivered with is delivered later in the JavaScript/node environment. Can you attach the image being delivered by JavaScript/node. You might (or you might not) find the command |
okay, found the issue. |
Ah, ha. I'm so happy. Time for a beer in the garden (25C in Camberley). |
Why is that though? Why does the |
Wahoo! You guys are both pretty damn awesome. @clanmills Sorry, I did a terrible job of giving you the resources you needed to help with this. |
Thanks, Andy. I'm delighted that JavaScript/node can use Exiv2. Thank you for making this possible. I'll reopen this issue to investigate the puzzle about Thank You for using Exiv2. |
There is a bug in Exiv2 concerning The size of the preview image is only correctly determined when the call is made to
I need to approach the fix with caution as this may require a change in the Exiv2 API This is a subtle bug. In JPEG and PNG files, the preview is stored as a binary "blob" in the image. The size_ is the size of the blob. The Canon DNG files are effectively TIFF files and use a subfile to store the preview, and determining the image |
Hey,
@myfreeweb and I are currently trying to debug an issue in his fork of exiv2node.
I have been finding that previews extracted via his fork and the original package are producing preview which are missing a little bit of data from the end.
We are wondering do you do some post-processing when the CLI tool extracts the image that we need to replicate in the package or is there a bug in the API?
This is the issue where we have been discussing this: valpackett/exiv2node#2
Here is a copy of the diff I generated:
The text was updated successfully, but these errors were encountered: