Cannot redeclare MyClass - but it's only declared once I'm trying to port an image effect from D7 to D8.

I've got Drupal to list the plugin, but when I try to use it I get a WSOD with "Fatal error:  Cannot redeclare class Drupal\image\Plugin\ImageEffect\EffectMagic".

I've checked and there is no other declaration of this class anywhere.

My file is in mymod/src/Plugin/ImageEffect/EffectMagic.php
and it looks like this (nb. content of functions is removed)

/**
 * @file
 * Contains \Drupal\image\Plugin\ImageEffect\EffectMagic.
 */

namespace Drupal\image\Plugin\ImageEffect;

use Drupal\Core\Image\ImageInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\image\ConfigurableImageEffectBase;

/**
 * Scales and crops an image resource.
 *
 * @ImageEffect(
 *   id = "image_effect_magic",
 *   label = @Translation("Effect Magic"),
 *   description = @Translation("Use ImageMagic command line to process images.")
 * )
 */
class EffectMagic extends ConfigurableImageEffectBase {
  public function buildConfigurationForm(array $form, FormStateInterface $form_state)
  public function validateConfigurationForm(array &amp;$form, FormStateInterface $form_state)
  public function submitConfigurationForm(array &amp;$form, FormStateInterface $form_state)
  public function applyEffect(ImageInterface $image)
  public function transformDimensions(array &amp;$dimensions, $uri)
  public function getSummary()
  public function defaultConfiguration()
}
When you are creating a custom module, you have to make sure your module registers its own namespace. In the current situation your module is attempting to use the namespace of the image module namespace Drupal\image\Plugin\ImageEffect;. Where you should actually be using a namespace of your own module namespace Drupal\mymod\Plugin\ImageEffect;

Then if you require functions of the image module, you can (as you have done already) load the other classes and functions with use. Like use Drupal\image\ConfigurableImageEffectBase;.