[BUGFIX] undefined variable imgExt

reducing colors in getImgResource function fails if not using
image-magick

Change-Id: I127ea54becd12a09cdd92a299e1f2d517d106763
Fixes: #34446
Releases: 4.7, 4.6, 4.5, 4.4
Reviewed-on: https://review.typo3.org/12840
Reviewed-by: Marcus Schwemer
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
Reviewed-by: Stefan Neufeind
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters