// 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.
Status ImageBundle::ShrinkTo(size_t xsize, size_t ysize) { if (HasColor()) {
JXL_RETURN_IF_ERROR(color_.ShrinkTo(xsize, ysize));
} for (ImageF& ec : extra_channels_) {
JXL_RETURN_IF_ERROR(ec.ShrinkTo(xsize, ysize));
} returntrue;
}
// Called by all other SetFrom*.
Status ImageBundle::SetFromImage(Image3F&& color, const ColorEncoding& c_current) {
JXL_ENSURE(color.xsize() != 0 && color.ysize() != 0);
JXL_ENSURE(metadata_->color_encoding.IsGray() == c_current.IsGray());
color_ = std::move(color);
c_current_ = c_current;
JXL_RETURN_IF_ERROR(VerifySizes()); returntrue;
}
Status ImageBundle::VerifyMetadata() const {
JXL_ENSURE(!c_current_.ICC().empty());
JXL_ENSURE(metadata_->color_encoding.IsGray() == IsGray());
if (metadata_->HasAlpha()) { const ImageF* a = alpha(); if (a->xsize() == 0) { return JXL_UNREACHABLE("MD alpha_bits %u IB alpha %" PRIuS " x %" PRIuS "\n",
metadata_->GetAlphaBits(), a->xsize(), a->ysize());
}
} const uint32_t alpha_bits = metadata_->GetAlphaBits();
JXL_ENSURE(alpha_bits <= 32);
// metadata_->num_extra_channels may temporarily differ from // extra_channels_.size(), e.g. after SetAlpha. They are synced by the next // call to VisitFields. returntrue;
}
// TODO(lode): let this function return lower bit depth if possible, e.g. // return 8 bits in case the original image came from a 16-bit PNG that // was in fact representable as 8-bit PNG. Ensure that the implementation // returns 16 if e.g. two consecutive 16-bit values appeared in the original // image (such as 32768 and 32769), take into account that e.g. the values // 3-bit can represent is not a superset of the values 2-bit can represent, // and there may be slight imprecisions in the floating point image.
}
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.