Skip to content
This repository was archived by the owner on Jun 11, 2021. It is now read-only.

resizeExactFillImage not placing the image in center #30

Open
pvincendeau opened this issue Jan 2, 2018 · 3 comments
Open

resizeExactFillImage not placing the image in center #30

pvincendeau opened this issue Jan 2, 2018 · 3 comments

Comments

@pvincendeau
Copy link

Use this in img-resize-exact seems to do the trick :

startX = (orientedImg.width - toWidth) / 2;
startY = (orientedImg.height - toHeight) / 2;

@bergben
Copy link
Owner

bergben commented Jan 2, 2018

Hey @pvincende001, what do you mean exactly? It seems like the image is centered perfectly in the demo plunkr? http://plnkr.co/edit/HRi5rQEDCBZb59a0lcPe?p=preview

@pvincendeau
Copy link
Author

The image is not centered perfectly even the plunker if you change the picture resize parameters :
image
If you use :
startX = (orientedImg.width - toWidth) / 2;
startY = (orientedImg.height - toHeight) / 2;
in the ng2ImgMaxService.resize method the image is then well centered.

@alignsoft
Copy link

I resize an image like this:

this.Ng2ImgToolsService.resizeImage(file, 1024, 10000)

The source image file is 2048 x 1386 px, the resulting image file is 1024 x 693, however the actual image area is 19 x 13 tucked into the top left corner of a black image.

I've reduced the images down to 200px wide and included them side by side for comparison, but I'm not sure how to fix this. Are there parameters I'm not passing correctly to the service?

2048v3_compare

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