// Copyright (c) the JPEG XL Project Authors. All rights reserved. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file.
// This C++ example decodes a JPEG XL image in one shot (all input bytes // available at once). The example outputs the pixels and color information to a // floating point image and an ICC profile on disk.
bool DecodeJpegXlExif(const uint8_t* jxl, size_t size,
std::vector<uint8_t>* exif) { auto dec = JxlDecoderMake(nullptr);
// We're only interested in the Exif boxes in this example, so don't // subscribe to events related to pixel data. if (JXL_DEC_SUCCESS != JxlDecoderSubscribeEvents(
dec.get(), JXL_DEC_BOX | JXL_DEC_BOX_COMPLETE)) {
fprintf(stderr, "JxlDecoderSubscribeEvents failed\n"); returnfalse;
} bool support_decompression = true; if (JXL_DEC_SUCCESS != JxlDecoderSetDecompressBoxes(dec.get(), JXL_TRUE)) {
fprintf(stderr, "NOTE: decompressing brob boxes not supported with the currently " "used jxl library.\n");
support_decompression = false;
}
std::vector<uint8_t> exif; if (!DecodeJpegXlExif(jxl.data(), jxl.size(), &exif)) {
fprintf(stderr, "Error while decoding the jxl file\n"); return 1;
} if (exif.empty()) {
printf("No exif data present in this image\n");
} else { // TODO(lode): the exif box data contains the 4-byte TIFF header at the // beginning, check whether this is desired to be part of the output, or // should be removed. if (!WriteFile(exif_filename, exif.data(), exif.size())) {
fprintf(stderr, "Error while writing the exif file\n"); return 1;
}
printf("Successfully wrote %s\n", exif_filename);
} return 0;
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.