
115 Ill. App.3d 717 (1983)
450 N.E.2d 910
THE PEOPLE OF THE STATE OF ILLINOIS, Plaintiff-Appellee,
v.
JOHN BRENTS, Defendant-Appellant.
No. 4-82-0449.
Illinois Appellate Court  Fourth District.
Opinion filed June 6, 1983.
*718 Daniel D. Yuhas and Jonathan Haile, both of State Appellate Defender's Office, of Springfield, for appellant.
J. William Roberts, State's Attorney, of Springfield (Robert J. Biderman and Kevin T. McClain, both of State's Attorneys Appellate Service Commission, of counsel), for the People.
Judgment affirmed.
JUSTICE BARRY delivered the opinion of the court:
The defendant was found guilty of armed robbery following a jury trial in the circuit court of Sangamon County. He was convicted and sentenced to a 20-year term of imprisonment. During the defendant's preliminary hearing on the armed robbery offense, he had become unruly in court, was held in contempt and sentenced to serve six months in jail. The sentencing court refused to grant credit for the four-month period of jail time elapsing between February 16, 1982, the date of contempt, and June 17, 1982, when the defendant was sentenced on the armed robbery conviction. The defendant appeals both his armed robbery conviction and his sentence insofar as he was not *719 given credit for the four months that he was held for contempt. We affirm.
 1 Defendant attempts to challenge his conviction on grounds that the trial court committed plain error in admitting into evidence at his trial three mug shots of him. The State's entire case against the defendant hinged on the complaining witness' identification of him as the person who had held her at gunpoint and robbed her.
The offense occurred on the evening of December 29, 1981, as Jill Sandner was preparing to leave a grocery store parking lot with her car and groceries. A person described by her as a black male in his late twenties, tall and of thin build, came up to the car, told her to move over, and drove her car some short distance before relieving her of her purse and letting her out. He then apparently drove a little further, parked the car and disappeared with Sandner's groceries, money and personal items from her purse. Sandner reported the incident to the Springfield police, and they located her car in the neighborhood near where she had been dropped off.
On January 8, 1982, Sandner went to the police station to review mug books of black adult males. At the conclusion of her search, Sandner had found three photographs of individuals resembling the man who had robbed her. Two of the photographs were of the defendant taken on two separate occasions, and the third was another individual. On January 22, 1982, Sandner was again at the police station, this time for the purpose of reviewing a photo lineup of five mug shots of individuals, one of whom was the defendant. Sandner selected the defendant's photo.
The defendant was arrested on January 25. A physical lineup conducted on January 27 again resulted in Sandner's identification of the defendant. At the defendant's trial on May 11, 1982, Sandner once again identified the defendant as the person who had robbed her the previous December. All of the photographs which had been identified by Sandner were admitted into evidence without objection at the defendant's trial; and the jury, again without objection by defendant, was permitted to take them into the jury room during their deliberations.
Because the defendant raised no objection at the trial to the admission of the mug shots into evidence and failed to include the issue in his post-trial motion, we will consider the issue on review only if the trial court's admission of the photos into evidence constitutes plain error. (See People v. Clark (1973), 12 Ill. App.3d 280, 297 N.E.2d 395.) We do not believe that the prejudice inherent in admitting mug shots into evidence rendered the trial court's ruling in the *720 instant case plainly erroneous.
 2 The purpose of admitting the mug photos was to demonstrate how the defendant was identified by Sandner. Although Sandner said she was not absolutely certain of her initial identification, she positively identified the defendant on three subsequent occasions  at the photo lineup, physical lineup and in court. The suggestiveness of this procedure was forcefully argued by defense counsel in an attempt to show that Sandner's in-court identification could not be believed by the jury. Sandner's credibility was at issue. She testified that she had observed the robber's face for about three minutes during the incident and that the lighting conditions were excellent in the grocery store parking lot. Since no other evidence identifying the robber, such as fingerprints, etc., was available, the process by which the complaining witness had made her identification was fundamental to establishing her credibility. The purpose for which the mug shots were introduced was not improper. (People v. Adams (1974), 22 Ill. App.3d 665, 318 N.E.2d 278.) Although we believe that it would have been preferable to have deleted the legends which conclusively displayed that the defendant had been in police custody on prior occasions (People v. Warmack (1980), 83 Ill.2d 112, 413 N.E.2d 1254), we cannot say that the probative value of the photos in the instant case was outweighed by their prejudice to this defendant. In our opinion, the evidence of the defendant's guilt was not closely balanced. Accordingly, the error, if any, in admitting the mug shots does not rise to the level of plain error in this case as aforesaid.
 3 The defendant's second issue on appeal appears to be one of first impression in Illinois. The defendant contends that he is entitled to credit for all jail time served between the date when he was first taken into custody and his sentencing for the instant offense by virtue of section 5-8-7(b) of the Unified Code of Corrections (Ill. Rev. Stat. 1981, ch. 38, par. 1005-8-7(b)). That section provides for credit "for time spent in custody as a result of the offense for which the sentence was imposed." (Emphasis added.) As the State correctly asserts, however, the jail time spent by the defendant from February 16 to the date of his sentencing was also the result of the defendant's six-month jail sentence imposed for criminal contempt. The question before us, then, is whether jail time served concurrently as a result of the charged offense and a subsequent criminal contempt sentence need be credited towards the sentence imposed on the first offense. We think not.
As a general rule, the defendant does not have a fundamental right to credit for time spent in custody prior to sentencing. The effect *721 of section 5-8-7(b) is to abrogate the general rule by legislatively granting credit for in-custody time under certain conditions. The justification for the enactment is obvious in a case such as this wherein the defendant's financial inability to make bail on the charged offense is the reason for his preconviction incarceration. In our opinion, this section of the statute does not mandate crediting of jail time where preconviction incarceration is also the result of a sentencing determination on a contempt-of-court citation. This is so even though the occasion of the defendant's court appearance resulted from the criminal charge for which he was originally held in custody awaiting trial.
 4 Federal courts, addressing the question before us with respect to analogous civil contempt situations, have consistently ruled that the trial judge has discretionary authority to give credit or not as justice requires under the circumstances. (Anglin v. Johnston (7th Cir.1974), 504 F.2d 1165, cert. denied (1975), 420 U.S. 962, 43 L.Ed.2d 440, 95 S.Ct. 1353; In re Application of U.S. Senate Permanent Subcommittee on Investigations (D.C. Cir.1981), 655 F.2d 1232, cert. denied (1981), 454 U.S. 1084, 70 L.Ed.2d 619, 102 S.Ct. 641. These well-reasoned cases provide ample grounds for holding that the matter of crediting or not the four-month period in question is best left to the sound discretion of the trial court. To hold otherwise would greatly diminish a defendant's incentive to comply with the trial court's order respecting proper decorum in the courtroom and render the contempt citation itself meaningless and inoperative.
 5 We have reviewed the language used by the defendant in this case as he addressed the trial judge at the defendant's preliminary hearing. We find no abuse of the court's discretion in its determination that the four-month period of incarceration subsequent to that incident should not be credited towards the 20-year sentence imposed for armed robbery.
For the foregoing reasons, we affirm the defendant's conviction and his sentence.
Affirmed.
ALLOY and HEIPLE, JJ., concur.
