Inkscape.org
Beyond the Basics Batch Processing Images Not Saving Files
  1. #1
    shatter6 shatter6 @shatter6

    I was hoping someone could tell me what is happening with this.

    Everything seems to be working, except its not actually saving any files

    I was hoping to be able to convert a bunch of .png images in to SVG nothing to crazy... I think.

    # Define the paths
    $inkscapePath = "C:\Program Files\Inkscape\bin\inkscape.exe" # Path to Inkscape executable
    $sourceFolder = "E:\Users\Owner\Desktop\Project Erravar\App\images\wiling\svg" # Folder with your images
    $destinationFolder = "E:\Users\Owner\Desktop\Project Erravar\App\images\wiling\svg\output" # Folder to save SVGs
    
    # Get all image files in the source folder
    $imageFiles = Get-ChildItem -Path $sourceFolder -Filter *.png # Change the filter as needed (*.jpg, *.bmp, etc.)
    
    # Loop through each file and process it
    foreach ($file in $imageFiles) {
        $svgFilename = [System.IO.Path]::ChangeExtension($file.Name, ".svg")
        $destinationPath = Join-Path $destinationFolder $svgFilename
    
        # Print the name of the SVG file being created
        Write-Host "Creating SVG: $destinationPath"
    
        # Command to open Inkscape, trace the bitmap, and save as SVG
        & $inkscapePath --without-gui --file="$file.FullName" --export-filename="$destinationPath" --actions="EditSelectAll;SelectionTrace;FileSave;FileClose"
    }
    
    Write-Host "Batch processing complete."

    I tried to annotate my thoughts on it but clearly there is something wrong.

    I have verified many times over all the file/folder paths and i get no error messages. Just no images are saved

    Thanks for  your time and assistance

    -Shatter

  2. #2
    inklinea inklinea @inklinea⛰️

    Where did you find the selectionTrace action ? 

     

  3. #3
    inklinea inklinea @inklinea⛰️

    Where did you find the selectionTrace action ? 

     

Inkscape Inkscape.org Inkscape Forum Beyond the Basics Batch Processing Images Not Saving Files