Image Crop Project in Django with Source Code

Image Crop Project in Django with Source Code

This Image Crop Project in Django created based on python, Django, and SQLITE3 Database. The project Image Crop is used to edit the picture that the user wants to edit. Users must first upload the jpg image that they want to crop before continuing to crop the image, display a preview in a modal, crop the image and finally upload it and save in the server.

This Image Crop Project in Django Framework, Also includes a Download Source Code for free, just find the downloadable source code below and click download now.

About ProjectProject DetailsDefinition
Project Name Image Crop Project in Django with Source CodeImage Crop Project in Django is an easy project for beginners to learn how to build a web-based python Django project. We will provide you with the complete source code and database for the python project so that you can easily install it on your machine and learn how to program in Python Django.
Python version (Recommended)3.8 VersionPython 3.8 introduces some new syntax to the language, as well as a few small modifications to existing behavior and, most importantly, a slew of performance improvements, following in the footsteps of the previous 3.7 version.
Programming Language UsedPython Django LanguageDjango is a high-level Python web framework for building safe and maintainable websites quickly. Django is a web framework built by experienced developers that takes care of a lot of the heavy lifting so you can focus on developing your app instead of reinventing the wheel.
Developer Name itsourcecode.comFree projects containing source code in Java, PHP, Python, Django, VB.Net, Visual Basic, C, C++, C#, Javascript, and other languages are available on this website.
IDE Tool (Recommended)Sublime, Visual Studio, PyCharmSublime Text is a source code editor that is available for purchase. It comes with built-in support for a variety of programming and markup languages. Plugins, which are often community-built and maintained under free-software licenses, allow users to extend the functionality of the system. Sublime Text has a Python API to help with plugins.
Project Type Web ApplicationA web application, unlike computer-based software programs that operate locally on the device’s operating system, is application software that runs on a web server. The user uses a web browser with an active network connection to access web apps.
DatabaseSQLiteSQLite is a programming language that is used to create embedded software for devices such as televisions, cell phones, and cameras. It can handle HTTP requests with low to medium traffic. SQLite has the ability to compress files into smaller bundles with less metadata. SQLite is a temporary dataset that is used within an application to process data.
Image Crop Project in Django with Source Code Overview

Image Crop Project in Django Steps on How to Create a Project

Time needed: 5 minutes.

Here’s the step’s on how to create a Image Crop Project in Django with Source Code.

  • Step 1: Open file.

    First , open “pycharm professional” after that click “file” and click “new project“.
    Create new Project for Billing System Project in Django with Source Code

  • Step 2: Choose Django.

    Next, after click “new project“, choose “Django” and click.
    choose django for Create new Project for Billing System Project in Django with Source Code

  • Step 3: Select file location.

    Then, select a file location wherever you want.
    Create Location Name for Image Crop Project in Django with Source Code

  • Step 4: Create application name.

    After that, name your application.

  • Step 5: Click create.

    Lastly, finish creating project by clicking “create” button.
    Finish Creating Project Name for Image Crop Project in Django with Source Code

  • Step 6: Start Coding.

    Finally, we will now start adding functionality to our Django Framework by adding some functional codes.

Functionality and Codes of the Image Crop Project in Django

  • Create template for the photo form in Image Crop Project Project in Django.

In this section, we will learn on how create a templates for the photo form. To start with, add the following code in your photo_form.html under the folder of /templates/photos.

Image Crop Project in Django with S...
Image Crop Project in Django with Source Code | Django Project with Source Code
{% extends "base.html" %}
{% load static %}

{% block styles %}

	<link  href="{% static 'css/cropper.min.css' %}" rel="stylesheet">
	<style type="text/css" media="screen">
		/* Limit image width to avoid overflow the container */
		img {
		  max-width: 100%; /* This rule is very important, please do not ignore this! */

{% endblock %}

{% block title %}

	Upload Photo

{% endblock %}

{% block content %}

<div class="container mt-5">
	<form method="post" enctype="multipart/form-data" id="formUpload">
  		{% csrf_token %}
  		{{ form.as_p }}
  		<button type="submit" id="formUploadButton" style="display: none;">Save</button>

	<div class="modal fade" id="modalCrop">
	  <div class="modal-dialog">
	    <div class="modal-content">
	      <div class="modal-header">
	        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
	          <span aria-hidden="true">&times;</span>
	        <h4 class="modal-title">Crop the photo</h4>
	      <div class="modal-body">
	        <img src="" id="image" style="max-width: 100%;">
	      <div class="modal-footer">
	        <div class="btn-group pull-left" role="group">
	          <button type="button" class="btn btn-default js-zoom-in">
	            <span class="glyphicon glyphicon-zoom-in"></span>
	          <button type="button" class="btn btn-default js-zoom-out">
	            <span class="glyphicon glyphicon-zoom-out"></span>
	        <button type="button" class="btn btn-default" data-dismiss="modal">Nevermind</button>
	        <button type="button" class="btn btn-primary js-crop-and-upload">Crop and upload</button>

	<div class="row mt-4">
	  {% for photo in photos %}
	    <div class="col-sm-4 col-md-3">
	    <a href="{{ photo.image.url }}" title="{{ photo.image }}">
	      	<img src="{{ photo.image.url }}" width="250" height="250" class="thumbnail">
	  {% endfor %}

<!-- container ends here -->

{% endblock content %}

{% block scripts %}

	<script src="{% static 'js/cropper.min.js' %}"></script><!-- Cropper.js is required -->
    <script src="{% static 'js/jquery-cropper.min.js' %}"></script>

    <script type="text/javascript">


		$("#id_image").change(function (e) {
		  if (this.files && this.files[0]) {
		    var reader = new FileReader();
		    reader.onload = function (e) {

		var $image = $("#image");
		var cropBoxData;
		var canvasData;
		$("#modalCrop").on("", function () {
		    viewMode: 1,
		    aspectRatio: 1/1,
		    minCropBoxWidth: 200,
		    minCropBoxHeight: 200,
		    ready: function () {
		      $image.cropper("setCanvasData", canvasData);
		      $image.cropper("setCropBoxData", cropBoxData);
		}).on("", function () {
		  cropBoxData = $image.cropper("getCropBoxData");
		  canvasData = $image.cropper("getCanvasData");

		// Enable zoom in button
		$(".js-zoom-in").click(function () {
		  $image.cropper("zoom", 0.1);

		// Enable zoom out button
		$(".js-zoom-out").click(function () {
		  $image.cropper("zoom", -0.1);

		$(".js-crop-and-upload").click(function () {
		  var cropData = $image.cropper("getData");


{% endblock %}

  • Create template for the base in Image Crop Project Project in Django.

In this section, we will learn on how create a templates for the base. To start with, add the following code in your base.html under the folder of /templates/.

{% load static %}

<!doctype html>
<html lang="en">
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">

    <title>{% block title %}Image Crop{% endblock %}</title>

    {% block styles %}{% endblock %}
    {% block content %}

      <h1>Hello, world!</h1>

    {% endblock %}

    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
    <script src="" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>

    {% block scripts %}

    {% endblock scripts %}

Downloadable Source Code Below.

Anyway, if you want to level up your programming knowledge, especially python, try this new article I’ve made for you Best Python Projects with source code for Beginners. But If you’re going to focus on web development using Django, you can download here from our list of Best Django Projects with source code based on real-world projects.

How To Run The Image Crop Project in Django?

  • Step 1: Extract/unzip the file
  • Step 2: Go inside the project folder, open cmd and type the following commands to install Django Framework and run the webserver:
  • python migrate
  • python runserver
  • Step 3: Finally, open the browser and go to


In summary, this 2022 Image Crop Project in Django with Source Code can be useful to students or professional who wants to learn python programming language. This project can also be modified to fit your personal requirements. Hope this project will help you to improve your skills. Happy Coding!


If you have any questions or suggestions about Image Crop Project in Django with Source Code, please feel free to leave a comment below.

Leave a Comment