question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting black image after crop.

See original GitHub issue

Hi,

I am getting “solid black” image after passing it through the getCroppedImg() function provided by the docs. The dimesions of the returned image is correct, however all I see is solid black color.

const reader = new FileReader();
const imageObject = new Image();
reader.readAsDataURL(fileObject);
reader.onload = () => {
	imageObject.src = reader.result;
};
const croppedImageBlob = await getCroppedImg(imageObject, crop, fileObject.name);
 console.log(URL.createObjectURL(croppedImageBlob));   //Pasting the URL in the browser shows a solid black image

Any help is appreciated. Thanks.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
norflin321commented, Jul 26, 2021

Final react component code with the problem solved: https://gist.github.com/norflin321/c8ce39f3fff2e73b7bc30b216b482a85

0reactions
DominicTobiascommented, Apr 10, 2022

Thanks for the gist, closing as the issue is old and from a major version ago

Read more comments on GitHub >

github_iconTop Results From Across the Web

Photoshop Goes Black When I Crop - 12441694
I go to crop an image. When I hit return, the whole screen goes black. I notice in the Properties panel on the...
Read more >
After crop image , it is black - Stack Overflow
1 Answer 1 ... $img_r = imagecreatefrompng($src);. what is $src ? its empty as i see it in your code, so your image...
Read more >
unwanted black line after crop on bottom and right side of photo
Hi, since i am using el capitan 10.11.1 with Aperture 3.6 using the crop tool, my photos get an unwanted thin black linearound...
Read more >
Black line when crop is close to border [#2998770] | Drupal.org
This effectively causes a 1-2px black border in the cropped image. See attached image: This should best be checked after the posting of...
Read more >
Crop a picture in Office - Microsoft Support
Select the Crop button. Black crop handles appear on the edges and corners of the picture. Cropped Image. Crop the image by doing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found