Open t-bltg opened 1 year ago
There is a high chance it's related to GC.@preserve, I had also previously noticed that I made entries and they weren't there in output. I had been told about it @gnimuc to make sure those checks(GC.@preserve) are there but my understanding of GC is limited. @johnnychen94 could you guide on what we are missing here?
I modify the test in write.jl a little bit:
path = joinpath(tempdir(), "tmp.jpg")
write_tags(path; img, tags)
# currently only .jpg supported, different value of these were already checked
# case where key in dict is not found needs to be handled,
# support level issue needs to be handled
@show "Read from file:" read_tags(path)
@show "Original:" tags
@test read_tags(path) == tags
rm(path)
Results:
Testing Running tests...
"Read from file:" = "Read from file:"
read_tags(path) = Dict("EXIF_TAG_FLASH" => "Flash fired", "EXIF_TAG_CUSTOM_RENDERED" => "Normal process", "EXIF_TAG_EXPOSURE_MODE" => "Auto exposure", "EXIF_TAG_SATURATION" => "Normal", "EXIF_TAG_YCBCR_POSITIONING" => "Co-sited", "EXIF_TAG_FNUMBER" => "f/2.8", "EXIF_TAG_SENSING_METHOD" => "One-chip color area sensor", "EXIF_TAG_PLANAR_CONFIGURATION" => "Planar format", "EXIF_TAG_FLASH_PIX_VERSION" => "FlashPix Version 1.0", "EXIF_TAG_ORIENTATION" => "Top-left", "EXIF_TAG_EXIF_VERSION" => "Exif Version 2.1", "EXIF_TAG_FOCAL_PLANE_Y_RESOLUTION" => "4.5", "EXIF_TAG_SHARPNESS" => "Normal", "EXIF_TAG_RESOLUTION_UNIT" => "Centimeter", "EXIF_TAG_COMPRESSION" => "JPEG compression", "EXIF_TAG_MODEL" => "R70", "EXIF_TAG_PIXEL_X_DIMENSION" => "2", "EXIF_TAG_USER_COMMENT" => "Dummy comment", "EXIF_TAG_COLOR_SPACE" => "sRGB", "EXIF_TAG_FOCAL_PLANE_RESOLUTION_UNIT" => "Inch", "EXIF_TAG_COMPONENTS_CONFIGURATION" => "Y Cb Cr -", "EXIF_TAG_GAIN_CONTROL" => "Normal", "EXIF_TAG_PHOTOMETRIC_INTERPRETATION" => "CieLAB", "EXIF_TAG_Y_RESOLUTION" => "300", "EXIF_TAG_ARTIST" => "Ashwani", "EXIF_TAG_PIXEL_Y_DIMENSION" => "2", "EXIF_TAG_SCENE_CAPTURE_TYPE" => "Standard", "EXIF_TAG_FOCAL_PLANE_X_RESOLUTION" => "4.5", "EXIF_TAG_SUBJECT_DISTANCE_RANGE" => "Close view", "EXIF_TAG_METERING_MODE" => "Pattern", "EXIF_TAG_MAKE" => "Canon", "EXIF_TAG_CONTRAST" => "Normal", "EXIF_TAG_X_RESOLUTION" => "300", "EXIF_TAG_WHITE_BALANCE" => "Auto white balance")
"Original:" = "Original:"
tags = Dict("EXIF_TAG_FLASH" => "Flash fired", "EXIF_TAG_CUSTOM_RENDERED" => "Normal process", "EXIF_TAG_EXPOSURE_MODE" => "Auto exposure", "EXIF_TAG_SATURATION" => "Normal", "EXIF_TAG_YCBCR_POSITIONING" => "Co-sited", "EXIF_TAG_FNUMBER" => "f/2.8", "EXIF_TAG_SENSING_METHOD" => "One-chip color area sensor", "EXIF_TAG_PLANAR_CONFIGURATION" => "Planar format", "EXIF_TAG_FLASH_PIX_VERSION" => "FlashPix Version 1.0", "EXIF_TAG_ORIENTATION" => "Top-left", "EXIF_TAG_EXIF_VERSION" => "Exif Version 2.1", "EXIF_TAG_FOCAL_PLANE_Y_RESOLUTION" => "4.5", "EXIF_TAG_SHARPNESS" => "Normal", "EXIF_TAG_RESOLUTION_UNIT" => "Centimeter", "EXIF_TAG_MODEL" => "R70", "EXIF_TAG_COMPRESSION" => "JPEG compression", "EXIF_TAG_PIXEL_X_DIMENSION" => "2", "EXIF_TAG_FOCAL_PLANE_RESOLUTION_UNIT" => "Inch", "EXIF_TAG_COLOR_SPACE" => "sRGB", "EXIF_TAG_GAIN_CONTROL" => "Normal", "EXIF_TAG_COMPONENTS_CONFIGURATION" => "Y Cb Cr -", "EXIF_TAG_USER_COMMENT" => "Dummy comment", "EXIF_TAG_Y_RESOLUTION" => "300", "EXIF_TAG_ARTIST" => "Ashwani", "EXIF_TAG_PIXEL_Y_DIMENSION" => "2", "EXIF_TAG_PHOTOMETRIC_INTERPRETATION" => "CieLAB", "EXIF_TAG_SCENE_CAPTURE_TYPE" => "Standard", "EXIF_TAG_FOCAL_PLANE_X_RESOLUTION" => "4.5", "EXIF_TAG_SUBJECT_DISTANCE_RANGE" => "Close view", "EXIF_TAG_METERING_MODE" => "Pattern", "EXIF_TAG_MAKE" => "Canon", "EXIF_TAG_CONTRAST" => "Normal", "EXIF_TAG_X_RESOLUTION" => "300", "EXIF_TAG_WHITE_BALANCE" => "Auto white balance")
Test Summary: | Pass Total Time
write-exif.jl | 1 1 2.6s
Testing ExifViewer tests passed
Both do have the "dummy comment" or even "foo 12345"
Yeah, this case on the "mandril" ref image is weird, and should be fixed.
There are a few GC.@preserve
examples in PNGFiles
: https://github.com/JuliaIO/PNGFiles.jl/blob/master/src/utils.jl, or https://github.com/JuliaIO/PNGFiles.jl/blob/master/src/io.jl, but this might also be unrelated ...
In continuation of https://github.com/JuliaImages/ExifViewer.jl/pull/25, some bugs are observed:
Could this be
GC.@preserve
related ?Also missing on the command line, so this is a write issue: