Closed mohd-akram closed 1 year ago
Hi @mohd-akram.
Yeah, sounds reasonable. Unfortunately I currently have no resources to work on that topic. Do you have and could you write a PR? Would be awesome.
Look at #73 @mohd-akram If you like, you can test them already. I need to implement tests, before the merge request is ready
I would urge to fetch the width and height automatically using sharp - there's no reason for the user to specify them since that data is in the image, and simply use the existing width
and height
parameters for resizing.
The linked pull request now also is able to recognize the marker image size, when not set. Currently I think only the offset must recalculated. But OpenSource time is over, so I will do it later.
I also tried to remove the additional needed time, by reuse the sharp instance for metadata, resize and composite. For some reason the sharp library cannot composite with an instance of itself. But to convert a Buffer into sharp instance probably takes less time. I will check this with some tests.
Took a while but finally added. Thank you very much @swarnat for all your work.
I'm using the
map.addMarker()
method and was surprised to find that thewidth
andheight
parameters are for specifying the image's dimensions, instead of the desired size. It might make more sense to get that information directly from the image's metadata, and have thewidth
andheight
parameters specify the desired output size on the map.