We cannot find a tool that would parse the html and extract the binary images, replacing the removed data stream with a link to the local image.
Requirement
Requires one or more html file to be passed to the app.
Optional prefix -p --prefix for the image, defaults to "image".
Option -nb --no-backup to disable backup files.
Option -f --force to enable overwriting of images.
Loop through each file in turn
If the file is missing or is not a html file, report error and continue with next html file
Unless the option -nb --no-backup is set, create a backup of the html file with a extension. Eg index.html would be copied to index.html.bak
Find all data:.*"> data streams
if any fail to be image <img src=data:image.*"> data streams, then exit the entire program with a error.
Save the image file to disk as ${fileprefix}_${prefix}_${increment}.${extension}, eg index_image_1_.jpg. Where:
${fileprefix} is the ${html file name%.*} of the current html file.
${prefix} is the provided --prefix string, or image if there is no --prefix provided.
${increment} is the current count of images parsed by the script
${extension} is the Media type of the image as discovered by the script
If the image already exists stop processing this html file and continue with the next. Except when the option -f --force is passed - then overwrite the images.
Replace the missing data stream it with a place holder <img src="${fileprefix}_${prefix}_${increment}.${extension}">, eg <img src="index_image_1_.jpg">
We cannot find a tool that would parse the html and extract the binary images, replacing the removed data stream with a link to the local image.
## Requirement
- Requires one or more html file to be passed to the app.
- Optional prefix `-p --prefix` for the image, defaults to "image".
- Option `-nb --no-backup` to disable backup files.
- Option `-f --force` to enable overwriting of images.
- Loop through each file in turn
- If the file is missing or is not a html file, report error and continue with next html file
- Unless the option `-nb --no-backup` is set, create a backup of the html file with a extension. Eg `index.html` would be copied to `index.html.bak`
- Find all `data:.*">` data streams
- if any fail to be image `<img src=data:image.*">` data streams, then exit the entire program with a error.
- Save the image file to disk as `${fileprefix}_${prefix}_${increment}.${extension}`, eg *index_image_1_.jpg*. Where:
- `${fileprefix}` is the `${html file name%.*}` of the current html file.
- `${prefix}` is the provided `--prefix` string, or *image* if there is no `--prefix` provided.
- `${increment}` is the current count of images parsed by the script
- `${extension}` is the Media type of the image as discovered by the script
- If the image already exists stop processing this html file and continue with the next. Except when the option `-f --force` is passed - then overwrite the images.
- Replace the missing data stream it with a place holder `<img src="${fileprefix}_${prefix}_${increment}.${extension}">`, eg `<img src="index_image_1_.jpg">`
Include a table of MIME types which are acceptable for further processing.
Maybe this could be in a configuration file to make it more straightforward to change.
Any data URI instances found which don't match the table would be rejected, or each instance could have a go/no-go marker.
- Include a table of MIME types which are acceptable for further processing.
- Maybe this could be in a configuration file to make it more straightforward to change.
- Any `data` URI instances found which don't match the table would be rejected, or each instance could have a `go/no-go` marker.
If external images are referenced then download them locally
eg: <img src="https://example.com/image.png" /> would be saved locally as ${fileprefix}_${prefix}_${increment}.${extension}
- If external images are referenced then download them locally
- eg: `<img src="https://example.com/image.png" />` would be saved locally as `${fileprefix}_${prefix}_${increment}.${extension}`
A first release of extract_images was made available in early January 2025.
It does not contain a MIME types table at present.
The request for external image collection has not yet been added.
A first release of `extract_images` was made available in early January 2025.
It does not contain a MIME types table at present.
The request for external image collection has not yet been added.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
We cannot find a tool that would parse the html and extract the binary images, replacing the removed data stream with a link to the local image.
Requirement
Requires one or more html file to be passed to the app.
Optional prefix
-p --prefixfor the image, defaults to "image".Option
-nb --no-backupto disable backup files.Option
-f --forceto enable overwriting of images.Loop through each file in turn
-nb --no-backupis set, create a backup of the html file with a extension. Egindex.htmlwould be copied toindex.html.bakdata:.*">data streams<img src=data:image.*">data streams, then exit the entire program with a error.${fileprefix}_${prefix}_${increment}.${extension}, eg index_image_1_.jpg. Where:${fileprefix}is the${html file name%.*}of the current html file.${prefix}is the provided--prefixstring, or image if there is no--prefixprovided.${increment}is the current count of images parsed by the script${extension}is the Media type of the image as discovered by the script-f --forceis passed - then overwrite the images.<img src="${fileprefix}_${prefix}_${increment}.${extension}">, eg<img src="index_image_1_.jpg">dataURI instances found which don't match the table would be rejected, or each instance could have ago/no-gomarker.<img src="https://example.com/image.png" />would be saved locally as${fileprefix}_${prefix}_${increment}.${extension}A first release of
extract_imageswas made available in early January 2025.It does not contain a MIME types table at present.
The request for external image collection has not yet been added.