I have a folder with over 600 of such SVG images, and I want to remove all objects with the color value #FFFFE6 in all of them to save space. I can't use a magic wand tool because the color is separated into so many pieces.
How do I remove it?
Graphic Design Stack Exchange is a question and answer site for Graphic Design professionals, students, and enthusiasts. It only takes a minute to sign up.
Sign up to join this communityI have a folder with over 600 of such SVG images, and I want to remove all objects with the color value #FFFFE6 in all of them to save space. I can't use a magic wand tool because the color is separated into so many pieces.
How do I remove it?
Basing on your example, the images are embedded within <defs></defs> block of the xml file.
You can try to use sed like in this example to remove the lines between <defs> and </defs>.
I'm on a Windows machine at the moment, and I've used a port, sed-windows, and the following command line get rid of the border of the image (beware that I've used the flag -i, that overrides the original file):
sed-4.7-x64.exe -i "/<defs>/,/<\/defs>/d" 12.svg
After this command, the SVG file is without the border (there are some graphical elements in circles, but I'm not able to understand them). See it here.
You can also use another similar command-line tools (awk, PowerShell, ...) and arrange a shell script to process all your images.
Update
If your original file is a PDF and you need to convert each page in SVG files, you can use a tool based on Poppler Library. For Windows you can find here a compressed file with the compiled binary utility pdftocairo.exe which can convert a PDF file to a SVG file.
In your case you simply need a shell script to extract each page and convert it to SVG. For example:
pdftocairo.exe -f 10 -l 10 -svg "Madina Mushaf_compressed.pdf" out_10.svg
The above command extract page 10 of the PDF and creates a SVG file, which you can process with sed.
SVG Images are created via text markup which is actually XML. Much like editing a web page markup, you can learn, evaluate, and edit the text markup of SVG files using a text editor. SVG files are not like other image formats on the web. They are not enclosed single elements. They are text and are as editable as any text used in web page construction.
Web browsers read an svg file as text and then construct and render an image based upon that text. This is very similar to the way editing Cascading Style Sheets for a web page are all done via text edits, but browsers render colors and shapes when they read the CSS files.
Open the SVG in a text editor and search for "FFFFE6" you find elements using that color. You can then alter the color in the text editor and then save with an .svg suffix... changing the resulting svg file.
See here for more on editing SVG Markup
It should be noted that while the text structure of SVG files is the way they were intended to be usesd. SVG files can contain embedded raster images. Such embedded raster images will not be editable in the text editor. Instead the text editor will show that there is embedded image data rather than directly editable XML markup.
So.... how difficult or easy an SVG image is to edit depends greatly upon how the SVG was constructed initially.