Two photoswitchable semiconducting polymers were synthesized by covalently incorporating photochromic dithienylethene (DTE) into the main chains. Small size polymer dots (Pdots) were prepared and showed dynamic photoswitching upon alternate light irradiation. By virtue of the tunable photoswitching properties, effective pattern encoding and superresolution imaging with a resolution of up to about 30 nm were achieved.