Add a option to trace color "by size"

Bug #1641314 reported by v1nce
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Confirmed
Wishlist
Unassigned

Bug Description

We got a lot of complaint @ inkscapeforum about color being dull after tracing.

I guess it's because of the color reduction algorithm.

I think we should provide an option to use a dumbest algorithm that will consider color only by their areas.
I think it will behave better on clipart image.

Here's a quick shell I wrote
It uses the histogram function of imagemagick to get the most significant colors and then it potraces every of them and join them in a final svg

#!/bin/bash
input=$1
output=$2
histogram="$2.tmp.histo"
tmpsvg="$2.tmp.svg"
tmpmask="$2.tmp.ppm"

convert $input -format %c -depth 8 histogram:info:"$histogram"
sed -i '$d' "$histogram"
sort -n -k1,1 -r -o "$histogram" "$histogram"
echo "<?xml version='1.0' standalone='no'?>" > "$output" ;
echo "<svg version='1.0' xmlns='http://www.w3.org/2000/svg'><g>" >> "$output" ;

i=1;
 while IFS= read -r line; do
  color="${line:27:6}";
  echo "processing color $color $i"
  i=$(($i+1))
  convert "$input" \
  -transparent "#$color" \
  -alpha extract \
  "$tmpmask"
  potrace -s "$tmpmask" -o "$tmpsvg"
  sed -ni '/transform/,/g>/p' "$tmpsvg"
  sed -i "s/#000000/#$color/" "$tmpsvg"
  cat "$tmpsvg" >> "$output"
done < "$histogram"
echo "</g></svg>" >> "$output"
rm "$histogram"
rm "$tmpsvg"
rm "$tmpmask"

jazzynico (jazzynico)
Changed in inkscape:
importance: Undecided → Wishlist
status: New → Confirmed
tags: added: preferences tracing
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.