Storage requirements for visual data have increased in recent years, following the appearance of manyinteractive multimedia services and applications for mobile devices in personal and business scenarios. This was a keya determining factor for the adoption of cloud-based data outsourcing solutions. However, even the outsourcing of datastorage in the cloud leads to new security challenges that must be carefully addressed. We propose a secure frameworkfor the storage and recovery of the subcontracted privacy protection in large archives of shared images. Our proposal isbased on IES-CBIR, a novel Encryption scheme of the image that presents image recovery properties based on content.The framework allows both encrypted storage and search using content-based image retrieval queries while preservingprivacy against honest but curious cloud administrators. We have built a prototype of the proposed framework,formally analyzed and tested its safety properties, and experimentally assessed its performance and accuracy ofrecovery. Our results show that IES-CBIR is probably safe, allowing more efficient operations that the existingproposals, both in terms of complexity of time and space, and opens the way to new scenarios of practical application.