Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

SpectrumKit not working in the case when you pass parameter with screenshot image but working fine with actual image. size(720,720), quality 80. #206

Open
neen-tech opened this issue Apr 9, 2020 · 4 comments

Comments

@neen-tech
Copy link

+(NSData*)spectrumData:(UIImage *)image size:(CGSize)size quality:(CGFloat)quality {
FSPEncodeRequirement *encodeRequirement =
[FSPEncodeRequirement encodeRequirementWithFormat:FSPEncodedImageFormat.jpeg
mode:FSPEncodeRequirementModeLossy
quality:quality];
FSPTransformations *transformations = [FSPTransformations new];
transformations.resizeRequirement =
[[FSPResizeRequirement alloc] initWithMode:FSPResizeRequirementModeExactOrSmaller
targetSize:size];
FSPConfiguration * configuration = [[FSPConfiguration alloc]init];
FSPEncodeOptions *options =
[FSPEncodeOptions encodeOptionsWithEncodeRequirement:encodeRequirement
transformations:transformations
metadata:nil
configuration:configuration
outputPixelSpecificationRequirement:nil];
NSError *error;
FSPSpectrum *spectrum = [[FSPSpectrum alloc] initWithPlugins:@[[FSPJpegPlugin new]]
configuration:nil];
FSPResultData *result = [spectrum encodeImage:image options:options error:&error];
return result.data;
}

@neen-tech neen-tech changed the title SpectrumKit not working in the case when you pass parameter with screenshot image and quality but working fine with actual image and quality . SpectrumKit not working in the case when you pass parameter with screenshot image but working fine with actual image. Apr 9, 2020
@neen-tech neen-tech changed the title SpectrumKit not working in the case when you pass parameter with screenshot image but working fine with actual image. SpectrumKit not working in the case when you pass parameter with screenshot image but working fine with actual image. size(720,720), quality 80. Apr 9, 2020
@diegosanchezr
Copy link
Contributor

Hi @08031992,

Could attach an actual image where this is not working?

@neen-tech neen-tech reopened this May 18, 2020
@neen-tech
Copy link
Author

Screenshot 2020-05-18 at 6 11 50 PM

Screenshot 2020-05-18 at 6 19 32 PM

@diegosanchezr
Copy link
Contributor

@08031992 I can't repro the issue unless you share the image you're trying to encode.

I can see you're getting an error there, so it might be useful to also share the exact error details.

@abbasnaqvi200
Copy link

abbasnaqvi200 commented May 25, 2023

Got Error while I compress cropped image

Optional

  • some : Error Domain=com.facebook.spectrum Code=255 "(null)" UserInfo={com.facebook.spectrum.error-name=scanline_conversion_unsupported_premultiplied_alpha, com.facebook.spectrum.error-location=facebook::spectrum::core::proc::DynamicScanlineConverter<facebook::spectrum::core::proc::indices::RGB, facebook::spectrum::core::proc::indices::RGB>::DynamicScanlineConverter(const image::pixel::Specification &, const image::pixel::Specification &, const image::Color &) [InputIndices = facebook::spectrum::core::proc::indices::RGB, OutputIndices = facebook::spectrum::core::proc::indices::RGB]:348}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants