Closed ngoan98tv closed 4 years ago
More info? iOS or android?
More info? iOS or android?
Android, I don't see any thing strange in debug logs. It just run normally, but when I check the output image, it stays original size.
Can you provide some gist code? I used the example and found no problems.
The example code also works well with me, but it's not work on my app. This's a snip of my code.
Future<List<int>> cropImageDataWithNativeLibrary() async {
print('Start cropping');
final state = editorKey.currentState;
final cropRect = state.getCropRect();
final action = state.editAction;
final int rotateAngle = action.rotateAngle.toInt();
final bool flipHorizontal = action.flipY;
final bool flipVertical = action.flipX;
final Uint8List img = state.rawImageData;
final option = ImageEditorOption();
if (action.needCrop) {
option.addOption(ClipOption.fromRect(cropRect));
}
if (action.needFlip) {
option.addOption(
FlipOption(horizontal: flipHorizontal, vertical: flipVertical));
}
if (action.hasRotateAngle) {
option.addOption(RotateOption(rotateAngle));
}
option.addOption(ScaleOption(300, 300));
option.outputFormat = OutputFormat.png(80);
final start = DateTime.now();
final result = await ImageEditor.editImage(
image: img,
imageEditorOption: option,
);
print('${DateTime.now().difference(start)} : total time');
print('${result.lengthInBytes} bytes');
return result;
}
I don't know why, but now it's work. Thanks for quickly support, @CaiJingLong
I'm trying to scale a 2000x2000 image to 300x300 by
addOption(ScaleOption(300,300))
but it's not working.