Tips

  1. Mac Corona simulator _TIPropertyValueIsValid warning

    2023-12-15 14:39:26.982 Corona Simulator[48574:2941064] _TIPropertyValueIsValid called with 4 on nil context!
    2023-12-15 14:39:26.982 Corona Simulator[48574:2941064] imkxpc_getApplicationProperty:reply: called with incorrect property value 4, bailing.
    2023-12-15 14:39:26.982 Corona Simulator[48574:2941064] Text input context does not respond to _valueForTIProperty:

    From Mac’s preference, add English input for keyboard, and Use it

  2. image magick

  • rename_image.sh x.png
#!/bin/bash
  # Function to check if a program is installed
  function is_installed() {
    command -v "$1" >/dev/null 2>&1
  }

  # Check if imagemagick is installed
  if ! is_installed "convert"; then
    echo "Error: ImageMagick is not installed. Please install it using your package manager."
    exit 1
  fi

  # Get the filename without extension
  filename="${1%.*}"

  # Check if a filename was provided
  if [ -z "$filename" ]; then
    echo "Error: Please provide a filename as an argument."
    exit 1
  fi

  # Rename to x@4x.png
  mv "$1" "$filename@4x.png"

  # Resize to 50% and rename to x@2x.png
  convert -resize 50% "$filename@4x.png" "$filename@2x.png"

  # Resize to 25% and rename to x.png
  convert -resize 25% "$filename@2x.png" "$filename.png"

  echo "Successfully renamed and resized the image."
background=$(convert input.png -format %c histogram:info:- | sort -rn | head -n 1 | xargs echo | cut -f 2 -d' ')
convert input.png -fuzz 10% -transparent rgb$background tmp1.png
convert tmp1.png -fill 'rgb(255,255,255)' -colorize 100 -background 'rgb(0,0,0)' -alpha remove output.png
  • exec_magic.command
OUTPUT="{{filename}}"
PROJPATH="{{path}}"
SANDPATH="{{tmp}}"
BINPATH="{{bin}}"
LOOP={{loop}}
DELAY=50

# 25= 4 fps

export MAGICK_HOME="$BINPATH"
export PATH="$MAGICK_HOME/bin:$PATH"
export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib/"
chmod u+x "$MAGICK_HOME/bin/convert"
convert -loop $LOOP -delay $DELAY "$SANDPATH"/capture_*.png $PROJPATH/"$OUTPUT".gif