You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all thanks for the awesome lib.I am facing a issue ,i am getting image buffer and i am able to show if i fix height and width in img element. But can u please help to identify the exact image width and height so it will come as it is.
Hi williamson,
I am using your mammoth plugin for docx to html conversion, everything is fine but I am not able retain the width and height of the image kindly suggest any method for this.
Thank You.
This should be a matter of parsing wp:extent or pic:spPr.a:xfrm.a:ext and grabbing its cx and cy for image width and height, respectively.
Just note that DOCX doesn't preserve the original image dimensions. We can get them from the image buffer, but it depends how Mammoth works (I'm just learning the ropes). I would love to have the resized image dimensions exposed from the parser. If I can figure out this package, I will open a pull request.
Reacted by Will Backer Rosenbauer and jan-schweiger
Opened an extremely rough pull request at #445. Would appreciate some guidance and discussion around the implementation in there, @mwilliamson. I see your PR description says new PRs are generally not accepted. I hope we can still discuss and ship this together. I would appreciate your help a ton!
Reacted by Will Backer Rosenbauer, Maria Tahler, kennyliu and jan-schweiger
Note that this pull request still needs some work to be done before it can be merged. I would appreciate if we gave Michael enough time to look into this and don't bump this issue until then. You can also sponsor his work because it's extremely time-consuming to be maintaining a widely-used project. Thanks.
Opened an extremely rough pull request at #445. Would appreciate some guidance and discussion around the implementation in there, @mwilliamson. I see your PR description says new PRs are generally not accepted. I hope we can still discuss and ship this together. I would appreciate your help a ton!
I'm afraid I'm still not accepting pull requests, although if you have minimal example documents from the sources you mentioned (Microsoft, Google Docs, Apple Pages), then they would be helpful to include in this issue.
Also, I'm new joining to the project, is there anywhere I can read about your stance of not accepting PRs? What does that mean for the project's development? Is this an actively maintained project?
I am in a dire need of a good DOCX parser. I've written one myself and it does 90% of what I need but that 10% is tricky. Mammoth nails those 10% well (but has some gaps in other areas, image dimensions being one of them). Waiting isn't part of my development culture so I'd like to know how much I can rely on this library! Thanks.
You should be able to upload the files as part of a comment.
Also, I'm new joining to the project, is there anywhere I can read about your stance of not accepting PRs?
It's generally more work to accept pull requests, especially given there are multiple implementations, than it is just to do the work myself.
What does that mean for the project's development?
It means the project is dependent on when I get the time and motivation to work on it, which is not much in the last few years.
Is this an actively maintained project?
It's actively maintained in that I'll try to address bugs and occasionally add support where it seems useful and in keeping with the philosophy of the project, but I wouldn't expect any significant additions at this point.
I am in a dire need of a good DOCX parser. I've written one myself and it does 90% of what I need but that 10% is tricky. Mammoth nails those 10% well (but has some gaps in other areas, image dimensions being one of them). Waiting isn't part of my development culture so I'd like to know how much I can rely on this library! Thanks.
If waiting isn't part of your development culture, and Mammoth doesn't already broadly cover what you need, then I'd suggest you shouldn't rely on this library.
Activity
gmchaturvedi1 commentedon Feb 13, 2019
please suggest if any other way @mwilliamson to solve this
gmchaturvedi1 commentedon Apr 18, 2019
Hi Please suggest if any update . Or suggest any way if i can achieve this
jaydevvaghela943 commentedon May 11, 2021
Hi Friends,
We can set image width and height by image option. But it apply on all image.

vijayis commentedon Mar 15, 2023
Hi williamson,
I am using your mammoth plugin for docx to html conversion, everything is fine but I am not able retain the width and height of the image kindly suggest any method for this.
Thank You.
kennylbj commentedon Apr 7, 2023
This code is working:
jan-schweiger commentedon Jun 14, 2024
Hi @mwilliamson,
do you maybe have any updates on this? This is the last missing requirement for us to test your library in production.
It would be great to get the size (width and height) that images have within the Word file.
I have attached a Word file, where I added an image that I resized.
Image Test.docx
mwilliamson commentedon Jun 15, 2024
No particular updates, and I've just finished my week off work so I have no idea when I'll have time to look at this, I'm afraid.
jan-schweiger commentedon Jun 15, 2024
Thank you for your quick reply again @mwilliamson. Hopefully a solution is possible in the near future.
kettanaito commentedon May 26, 2025
This should be a matter of parsing
wp:extentorpic:spPr.a:xfrm.a:extand grabbing itscxandcyfor image width and height, respectively.Just note that DOCX doesn't preserve the original image dimensions. We can get them from the image buffer, but it depends how Mammoth works (I'm just learning the ropes). I would love to have the resized image dimensions exposed from the parser. If I can figure out this package, I will open a pull request.
rosenbauerwillbacker commentedon May 26, 2025
A solution would be really great. Any updates on this one @mwilliamson?
mwilliamson commentedon May 26, 2025
Nope, no updates.
kettanaito commentedon May 27, 2025
Opened an extremely rough pull request at #445. Would appreciate some guidance and discussion around the implementation in there, @mwilliamson. I see your PR description says new PRs are generally not accepted. I hope we can still discuss and ship this together. I would appreciate your help a ton!
mariatahler commentedon May 27, 2025
This would be a great addition to Mammoth. Would it be possible to accept this PR?
kettanaito commentedon May 27, 2025
Note that this pull request still needs some work to be done before it can be merged. I would appreciate if we gave Michael enough time to look into this and don't bump this issue until then. You can also sponsor his work because it's extremely time-consuming to be maintaining a widely-used project. Thanks.
jan-schweiger commentedon May 27, 2025
Thanks for the info @kettanaito, I can imagine. Thanks for the link, I (or my start-up) will donate some money this week.
mwilliamson commentedon May 28, 2025
I'm afraid I'm still not accepting pull requests, although if you have minimal example documents from the sources you mentioned (Microsoft, Google Docs, Apple Pages), then they would be helpful to include in this issue.
kettanaito commentedon May 28, 2025
What will be the best way to share them here?
Also, I'm new joining to the project, is there anywhere I can read about your stance of not accepting PRs? What does that mean for the project's development? Is this an actively maintained project?
I am in a dire need of a good DOCX parser. I've written one myself and it does 90% of what I need but that 10% is tricky. Mammoth nails those 10% well (but has some gaps in other areas, image dimensions being one of them). Waiting isn't part of my development culture so I'd like to know how much I can rely on this library! Thanks.
mwilliamson commentedon May 28, 2025
You should be able to upload the files as part of a comment.
It's generally more work to accept pull requests, especially given there are multiple implementations, than it is just to do the work myself.
It means the project is dependent on when I get the time and motivation to work on it, which is not much in the last few years.
It's actively maintained in that I'll try to address bugs and occasionally add support where it seems useful and in keeping with the philosophy of the project, but I wouldn't expect any significant additions at this point.
If waiting isn't part of your development culture, and Mammoth doesn't already broadly cover what you need, then I'd suggest you shouldn't rely on this library.
kettanaito commentedon May 29, 2025
Really appreciate the response!