0% found this document useful (0 votes)
90 views22 pages

Report-2 (1) NEW

Uploaded by

gf1166679
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views22 pages

Report-2 (1) NEW

Uploaded by

gf1166679
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

A Project Report On

“ASCII ART (IMAGE TO ASCII ART ) USING


JAVA”
SUBMITTED TO THE MUMBAI UNIVERSITY, MUMBAI IN PARTIAL
FULFILLMENT OF THE REQUIREMENTS FOR THE AWARD OF THE
DEGREE THE SEM III

BATCHELOR OF ENGINEERING (Artificial Intelligence


and Machine Learning)

BY

MR. MUKESH SHARMA

MR. DIPESH GAUTAM

Supervisor:
PROF. HARISH K. BARAPATRE

YADAVRAO TASGAONKAR INSTITUTE OF

ENGINEERING AND TECHNOLOGY


Affiliated to
UNIVERSITY OF MUMBAI

DEPARTMENT OF ARTIFICIAL INTELLIGENCE


AND MACHINE LEARNING
ACADEMIC YEAR:2024-25
YADAVRAO TASGAONKAR INSTITUTE OF
ENGINEERING AND TECHNOLOGY
BHIVPURI RD. KARJAT (M.S.)

——————————————————————————————————————

DEPARTMENT OF ARTIFICIAL INTELLIGENCE AND


MACHINE LEARNING UNIVERSITY OF MUMBAI
PROJECT WORK DETAIL

Name of Student MR. MUKESH SHARMA

Name of Student MR. DIPESH GAUTAM

Course S.E (Artificial Intelligence and Machine


Learning)
YEAR 2024-25

PROJECT TITLE ASCII ART ( IMAGE TO ASCII ART )


BY USING JAVA
Prof. Harish K. Barapatre
Name of Guide
YADAVRAO TASGAONKAR INSTITUTE OF
ENGINEERING AND TECHNOLOGY
BHIVPURI RD. KARJAT (M.S.)
——————————————————————————–
DEPARTMENT OF ARTIFICIAL INTELLIGENCE AND
MACHINE LEARNING CERTIFICATE
This is to certify that the TE Project entitled

“ASCII ART ( IMAGE TO ASCII ART ) BY USING JAVA”


Submitted by
MR.MUKESH SHARMA
MR.DIPESH GAUTAM
does He/she carry out a bonafide work under the supervision of Prof. Harish K. Barapatre. and
it is submitted towards the fulfilment of the requirement of the University of Mumbai for the
award of the degree of Bachelor of Engineering in Artificial Intelligence and Machine Learning
T.E. SEM-V for academic year 2024 - 2025

Prof. Harish Barapatre Prof. Yashika Vadnerkar


Supervisor Project Coordinator

Prof. Harish Barapatre DR. NILESH M. PAWAR


Head of Department Principal, YTIET

Date:
Place:
YADAVRAO TASGAONKAR INSTITUTE OF
ENGINEERING AND TECHNOLOGY
BHIVPURI RD. KARJAT (M.S.)
——————————————————————————–
DEPARTMENT OF ARTIFICIAL INTELLIGENCE AND
MACHINE LEARNING CERTIFICATE OF APPROVAL
This is to certify that the project TE Project entitled

“ASCII ART ( IMAGE TO ASCII ART ) BY USING JAVA”


Submitted by
MR.MUKESH SHARMA
X`x`MR.DIPESH GAUTAM

is approved for the degree of Batchlor of Engineering in Artificial Intelligence and Machine
Learning SEM-V for academic year 2024 - 2025.

Prof. Harish Barapatre Name And Sign of


Supervisor Examinar

Prof. Harish Barapatre Name And Sign of


Head of Department Examinar
YADAVRAO TASGAONKAR INSTITUTE OF

Date:
Place:

ENGINEERING AND TECHNOLOGY


BHIVPURI RD. KARJAT (M.S.)
——————————————————————————–
DEPARTMENT OF ARTIFICIAL INTELLIGENCE AND
MACHINE LEARNING

DECLARATION BY STUDENT

I declare that this written submission represents my ideas in my own words and where others
ideas or words have been included. I have adequately cited and referenced the original sources.
I also declare that I have adhered to all principles of academic honesty and integrity and have
not misrepresented or fabricated or falsified any idea/data/fact/source in my submission. I
understand that any violation of the above will be cause for disciplinary action by the Institute
and can also evoke penal action from the sources which have thus not been properly cited or
from whom proper permission has not been taken when needed.

Place : Bhivpuri Rd. Karjat Mr.MUKESH SHARMA


Date : Mr.DIPESH GAUTAM
Abstract
This project focuses on converting digital images into ASCII art using Java
programming. ASCII art is a graphic design technique that uses characters
from the ASCII set to create visual representations of images. The system
reads an image, processes the pixel data, and translates the brightness and
contrast values into corresponding ASCII characters. By mapping grayscale
values to a set of characters, such as @, #, and ., the project generates a textual
image that visually resembles the original.
The core functionalities of this project involve image processing, pixel
manipulation, and character mapping. The program utilizes Java's Buffered
Image class for reading and manipulating images, and it calculates the
brightness of each pixel by averaging its RGB values. The brightness is then
mapped to an appropriate ASCII character based on a predefined set of
symbols. This project demonstrates object-oriented programming principles
and highlights the integration of image processing and text generation. Its
applications can be extended to artistic image representations, as well as
performance optimization for low-bandwidth environments where
transmitting ASCII art instead of images can save data.

Keywords:

ASCII art, image processing, Java, Buffered Image, pixel manipulation,


character mapping, grayscale conversion, object-oriented programming, text
generation, artistic representation
Contents

1 INTRODUCTION 1
1.1 OVERVIEW ........................................................................................................................ 1
1.2 OBJECTIVES ..................................................................................................................... 1
1.3 CHALLENGES ................................................................................................................... 2
1.4 SCOPE ....................................................................................................................... .......... 3

2 EXISTING SYSTEM AND DIS-ADVANTAGES 4

3 LITERATURE SURVEY 5
3.1 Comparative Analysis ......................................................................................................... 5

4 PROBLEM DEFINATION 6

5 PROPOSED SYSTEM 7
5.1 System Architecture ......................................................................................................... ... 7

6 METHODOLOGY 8
6.1 PROPOSED ALGORITHUM ............................................................................................
8

7 SYSTEM DESIGN 9
7.1 UML diagram-class diagram and sequence DFD ..............................................................
9
8 APPLICATION 10

9 SUMMARY 11

10 REFERENCES 12

7
List of Figures
Figure 1: Flowchart of the Image to ASCII Art Conversion
Process
Figure 2: Example of Input Image (Original Image Sample)
Figure 3: ASCII Character Set Used for Grayscale Mapping
Figure 4: Architecture of the ASCII Art Generator Application in
Java
Figure 5: Code Snippet of Image Loading and Conversion to
Grayscale
Figure 6: Mapping Grayscale Values to ASCII Characters
(Diagram)
Figure 7: Sample Console Output of Generated ASCII Art
Figure 8: Screenshot of the Application Running in NetBeans
IDE
Figure 9: Comparison of Input Image vs. ASCII Art Output
(Side-by-Side View)
Figure 10: User Interface or Command-Line Interaction for
ASCII Art Conversion (Optional)
Figure 11: Handling Image Resizing and Scaling to Fit ASCII
Constraints (Diagram)
Figure 12: Example of Colored ASCII Art (If Implemented)
Figure 13: Performance Analysis Graph (Execution Time vs.
Image Size)

8
List of Tables

Table 1: ASCII Characters and Their Corresponding Grayscale Values


Table 2: Tools and Technologies Used in the Project (e.g., Java, Libraries)
Table 3: Input Image Properties (Resolution, Format, Size)
Table 4: ASCII Art Configuration Parameters (Height, Character Density)
Table 5: Comparison of Different Grayscale to ASCII Mapping Techniques
Table 6: Sample Input and Corresponding ASCII Output (Side-by-Side
Comparison)
Table 7: Execution Time for Different Image Sizes (Performance Analysis)
Table 8: Memory Usage Based on Image Resolution and ASCII Output
Length
Table 9: Error Handling Cases and Corresponding Solutions
Table 10: Limitations and Challenges Faced During Development
Table 11: User Feedback or Test Results (If Usability Testing Was
Conducted)
Table 12: Comparison of ASCII Art with and without Scaling Adjustments

9
CHAPTER 1

INTRODUCTION

1.1 OVERVIEW
The ASCII Art (Image to ASCII Art) project in Java converts digital
images into text-based representations using characters from the ASCII
set. It reads an image, processes pixel data, and calculates the
brightness of each pixel by averaging its RGB values. Based on this
brightness, each pixel is replaced with an ASCII character, creating a
visual pattern that resembles the original image. This project
demonstrates Java’s image processing abilities using classes like
Buffered Image and showcases pixel manipulation, character mapping,
and grayscale conversion techniques. The result is an artistic yet
functional way to represent images with text, suitable for creative or
bandwidth-efficient applications.

1.2 OBJECTIVES
The main objective of this project is:

 Convert Images to ASCII Art: Develop a Java program that transforms


digital images into ASCII art representations.

 Image Processing: Implement pixel manipulation techniques to extract


grayscale values from images.

 Character Mapping: Map pixel brightness values to appropriate ASCII


characters based on their visual density.

 Grayscale Conversion: Convert RGB pixel data to grayscale for


simplified character assignment.

 Scalable Output: Allow for resizing images to optimize the ASCII


representation based on resolution.

 Efficient Performance: Ensure the program efficiently processes images,


even large ones, to generate ASCII art quickly.
 Text Output: Display or export ASCII art to a console, text file, or other

CHALLENGES FOR ASCII ART (IMAGE TO ASCII ART) PROJECT IN


JAVA:

Character Mapping Precision: Accurately mapping pixel brightness to the correct


ASCII character requires balancing a set of characters to represent varying shades of
brightness effectively.

Handling Image Resolution: High-resolution images can result in very large ASCII
outputs, making it challenging to maintain readability and performance.

Grayscale Conversion Accuracy: Converting RGB values to grayscale in a way that


captures the original image’s detail and contrast can be difficult, especially for
colorful or highly detailed images.

Aspect Ratio Preservation: Ensuring the ASCII output maintains the aspect ratio of
the original image is tricky, especially since characters have varying widths and
heights.

Performance Optimization: Processing large images pixel by pixel and mapping


them to ASCII characters can be slow, requiring efficient algorithms to speed up the
conversion.

Limited Visual Depth: ASCII characters offer limited visual depth compared to
pixels, making it challenging to replicate fine details in the image.

Contrast and Detail Loss: Small details or color contrasts in the image may not be
well-represented in the ASCII version, leading to oversimplification.

Platform Compatibility: Ensuring the ASCII output renders correctly across different
platforms and environments (like varying font settings or terminal sizes) can be a
challenge
1.4 SCOPE
Scope for ASCII Art (Image to ASCII Art) Project in Java:

Artistic Image Representation: The project can be used to create visually


appealing ASCII art for creative purposes, such as designing posters, avatars,
or digital art.

Low-Bandwidth Image Transmission: ASCII art can be used in environments


with limited bandwidth, where transmitting an image as text saves data while
still providing a visual representation.

Console-Based Games and Applications: ASCII art can be integrated into text-
based games or console applications where graphical elements are represented
with text characters. Learning and Demonstration of Image Processing: This
project serves as an educational tool for understanding key image processing
concepts such as pixel manipulation, grayscale conversion, and brightness
calculation. Cross-Platform Compatibility: ASCII art can be generated and
displayed on various platforms (web, console, text files) without the need for
graphical rendering, making it versatile. Text-Based Interfaces: It can be used
in systems where graphical interfaces are limited or unavailable, such as old
terminals or command-line interfaces. Real-Time Image-to-Text Conversion:
The project can be extended to support real-time conversion of images from live
video feeds or webcam snapshots to ASCII art.Integration with Social Media or
Messaging Platforms: ASCII art can be adapted for use in chat applications,
email signatures, or social media posts, offering a unique way of sharing visual
content
CHAPTER 2

EXISTING SYSTEM AND DIS-ADVANTAGES

The concept of converting images to ASCII art is not new, and


several existing systems and tools, including web-based
applications and command-line utilities, are capable of performing
this task. Some popular tools include ImageMagick, jp2a, and
Picasso, which are used for converting images to ASCII in various
programming languages or platforms. These tools usually provide
features like image scaling, color conversion, and ASCII character
mapping based on pixel intensity.

DISADVANTAGES :

1. Loss of Image Detail:ASCII art simplifies images, causing


fine details and color gradients to be lost, especially in complex
images.

2. Limited Character Set:The ASCII character set has limited


visual depth, making it challenging to capture intricate image
variations.

3. Aspect Ratio Distortion: Maintaining the original image’s


aspect ratio is difficult, often resulting in distorted or stretched
ASCII representations.

4. Performance Issues with Large Images: Processing large or


high-resolution images can be time-consuming, leading to slower
program execution and increased memory usage.

5.

LITERATURE SURVEY
CHAPTER 3
In the past decade, a variety of geographic routing protocols have been
proposed, such as [3], [4], [6], [7],. Below, several researches on them
are shown.

3.1 Comparative Analysis


The comparative analysis of existing literature on ASCII art conversion
tools highlights the diversity in capabilities, ease of use, and output
quality. Tools such as ImageMagick and jp2a provide comprehensive
features, including image scaling and extensive character mapping, but
often require complex installations and lack customization options.
Online converters, while user-friendly, frequently compromise output
quality and are limited in their handling of high-resolution images.
Additionally, many tools fail to maintain the correct aspect ratio,
resulting in distorted ASCII representations. Moreover, performance
issues arise with larger images, leading to slower processing times and
increased memory consumption. Existing systems also exhibit
inconsistencies in output rendering across different platforms and text
editors. Overall, there remains a gap in the literature for a Java-based
solution that combines efficiency, customization, and high-quality
output, addressing the limitations of current tools while providing a
user-friendly experience for creating ASCII art from images.

PROBLEM DEFINATION
The problem definition for the ASCII Art (Image to ASCII Art) project in Java
focuses on the challenge of converting digital images into text-based
representations effectively. Current systems often struggle with issues such as
loss of detail, inaccurate aspect ratios, and limited customization options,
resulting in suboptimal ASCII outputs. The project aims to address these
CHAPTER 4
limitations by developing a Java application that accurately transforms images
into ASCII art while preserving visual integrity and detail. Key challenges
include efficiently processing various image formats, implementing precise
grayscale conversion to map brightness to ASCII characters accurately, and
maintaining the original image’s aspect ratio during conversion. Furthermore,
the application should provide options for users to customize the character set
and output size to enhance artistic expression. Ultimately, the goal is to create
a robust, user-friendly solution that bridges the gap in existing tools, facilitating
high-quality ASCII art generation for both creative and practical applications.
CHAPTER 5

PROPOSED SYSTEM
5.1 System Architecture
The proposed system architecture for the ASCII Art (Image to ASCII
Art) project in Java consists of three main components: Input
Processing, Image Conversion, and Output Generation.

 Input Processing: This module handles user input, allowing users to


upload images in various formats (e.g., PNG, JPEG). It validates the
input and prepares the image for processing.

 Image Conversion: This core module performs several tasks. First, it


utilizes Java’s BufferedImage class to read the image and extract pixel
data. Next, it converts the image to grayscale by averaging the RGB
values of each pixel, which simplifies the character mapping process.
The brightness of each pixel is calculated and mapped to an appropriate
ASCII character from a customizable set based on predefined brightness
thresholds.

 Output Generation: After the conversion, this module formats the ASCII
characters into a cohesive output. It can display the ASCII art in the
console or export it to a text file. Additionally, users can adjust settings
such as output size and character set, enhancing customization and
artistic expression.

This architecture provides a clear workflow, ensuring efficient


processing and user-friendly interaction while addressing the limitations
of existing systems.
CHAPTER 6

METHODOLOGY

6.1 PROPOSED ALGORITHUM

The methodology for the ASCII Art project involves several key steps to
ensure an effective image-to-ASCII conversion. First, the user uploads an
image, which is validated and processed for compatibility. The image is then
loaded using the BufferedImage class, and its pixel data is accessed.Next, the
algorithm converts the image to grayscale by averaging the RGB values for
each pixel. This grayscale value determines the brightness level, which is
mapped to a corresponding ASCII character based on predefined thresholds. A
character set is utilized, with denser characters representing darker pixels and
lighter characters representing brighter pixels.The converted ASCII characters
are arranged into a grid to maintain the image’s structure. Users can specify
the desired output size to ensure that the aspect ratio is preserved. Finally, the
ASCII art is displayed in the console or saved to a text file, providing a visual
representation of the original image while allowing for customization and
artistic expression.The methodology for the ASCII Art project involves
several steps for effective image conversion. First, the user uploads an image,
which is validated for compatibility. The image is read using the
BufferedImage class, and its pixel data is accessed. The algorithm converts the
image to grayscale by averaging RGB values for each pixel, determining
brightness levels. These levels are mapped to ASCII characters from a
predefined set, where denser characters represent darker pixels. The ASCII
characters are arranged in a grid to maintain structure, and the final output is
displayed in the console or saved to a text file for user access.
CHAPTER 7

SYSTEM DESIGN

7.1 UML diagram-class diagram and sequence DFD


System Design for ASCII Art Project :

The system design for the ASCII Art project includes a Class Diagram,
Sequence Diagram, and Data Flow Diagram (DFD), illustrating the
architecture and interactions within the application.

The Class Diagram features key classes such as Image Processor, responsible
for loading and processing images with methods like loadImage(),
convertToGrayscale(), and getPixelData(). The AsciiConverter class handles
the mapping of grayscale values to ASCII characters through its
mapBrightnessToAscii() method. The AsciiArtGenerator is tasked with
creating the ASCII art and includes methods like generateAsciiArt() and
displayAsciiArt(). Finally, the UserInterface class manages user interactions,
allowing image uploads and output configurations through methods like
uploadImage() and showOutput().

The Sequence Diagram Illustrates user interactions, beginning with the user
uploading an image via the UserInterface. This action prompts the
ImageProcessor to retrieve pixel data, convert it to grayscale, and pass the data
to the AsciiConverter for character mapping. The ASCII art is generated and
displayed back to the user.

The Data Flow Diagram (DFD) visually represents the data movement
throughout the system, showcasing how input images flow through processing
stages to produce the final ASCII art output. This structured design facilitates
efficient image conversion while enhancing user experience.
CHAPTER 8

APPLICATION
Applications of ASCII Art (Image to ASCII Art) Project in Java:

1. Digital Art Creation: Artists can create unique ASCII art representations
of images, combining creativity with programming skills for visual
expression.

2. Low-Bandwidth Communication: ASCII art can be used in


environments with limited internet connectivity, allowing users to share
visual content without heavy image files.

3. Text-Based Games: ASCII art can enhance console-based games,


providing graphics and visual elements that fit the text-only environment.

4. Creative Programming Projects: The project serves as an engaging way


to explore image processing and character mapping techniques within
programming courses.

5. Social Media Sharing: Users can generate and share ASCII art
representations of their favorite images on social media platforms, appealing
to niche audiences.

6. Email Signatures: ASCII art can be used in email signatures, providing


a unique and artistic touch to personal or professional communication.

7. Educational Tools: The project can be utilized in classrooms to teach


concepts of image processing, programming logic, and digital art.

8. Interactive Displays: ASCII art can be integrated into interactive


displays or installations, combining visual art with technology for innovative
experiences.
CHAPTER 9

SUMMARY
Summary of ASCII Art (Image to ASCII Art) Project in Java

The ASCII Art project in Java focuses on converting digital images into ASCII
text representations, allowing users to experience art in a unique, text-based
format. The project utilizes Java’s powerful image processing capabilities,
specifically the BufferedImage class, to read and manipulate image data
effectively. The conversion process involves several steps: the user uploads an
image, which is validated and processed to extract pixel data. Each pixel is
converted to grayscale to determine brightness levels, which are then mapped
to corresponding ASCII characters based on predefined thresholds.

The resulting ASCII art retains the original Image's structure and detail, albeit
in a simplified form. This project not only serves artistic purposes but also
showcases practical applications in low-bandwidth scenarios where efficient
image representation is needed. The user-friendly interface allows for
customization, enabling users to select character sets and output sizes to
enhance artistic expression. Furthermore, the project has educational value,
teaching fundamental concepts in image processing, programming, and design.
By bridging the gap between visual art and text, the ASCII Art project presents
a creative solution for representing images, making it a valuable tool for artists,
educators, and tech enthusiasts alike.
REFERENCES
1. Books & Research Papers:
- Kernighan, B.W., & Ritchie, D.M. (1988). *The C Programming Language.*
Prentice Hall.
- Though this book is about C, it’s often cited in discussions on low-level
programming principles, which can provide context about ASCII handling.
- Knuth, D.E. (1997). *The Art of Computer Programming, Volume 1:
Fundamental Algorithms.* Addison-Wesley.
- This can offer theoretical insight into algorithms used in ASCII
transformations.

2. Web Resources:
- *Oracle Documentation*
URL: https://docs.oracle.com/en/java/
- Use this to reference specific Java APIs you employed (like `BufferedImage`,
`Graphics`, or `ImageIO` for image handling).
- Wikipedia contributors. "ASCII Art." *Wikipedia, The Free Encyclopedia,*
[https://en.wikipedia.org/wiki/ASCII_art](https://en.wikipedia.org/wiki/ASCII
_art).

3. Tutorials & Blogs:


- GeeksforGeeks. "Image Processing in Java."
URL: https://www.geeksforgeeks.org/image-processing-java/
- This tutorial offers practical steps to load, process, and manipulate images
in Java.

4. Academic Articles:
- Barrow, H. G., & Tenenbaum, J. M. (1978). "Recovering Intrinsic Scene
Characteristics from Images." *Computer Vision Systems*, 3(2), 85-91.
- This article, though older, is relevant if you discuss image transformation
concepts theoretically.

5. Java-Specific Libraries:
- Tess4J Documentation (If OCR was included in your project):
URL: https://tess4j.sourceforge.net/
- You might reference this if you integrated any OCR functionality to
convert text images into ASCII art.

You might also like